1 // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO 2 // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO 3 // RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO 4 // FIXME: Run the following command once LTOPreLinkDefaultPipeline is 5 // customized. 6 // %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO 7 // Checks if hot call is inlined by normal compile, but not inlined by 8 // thinlto compile. 9 10 int baz(int); 11 int g; 12 13 void foo(int n) { 14 for (int i = 0; i < n; i++) 15 g += baz(i); 16 } 17 18 // SAMPLEPGO-LABEL: define void @bar 19 // THINLTO-LABEL: define void @bar 20 // SAMPLEPGO-NOT: call{{.*}}foo 21 // THINLTO: call{{.*}}foo 22 void bar(int n) { 23 for (int i = 0; i < n; i++) 24 foo(i); 25 } 26 27 // Checks if loop unroll is invoked by normal compile, but not thinlto compile. 28 // SAMPLEPGO-LABEL: define void @unroll 29 // THINLTO-LABEL: define void @unroll 30 // SAMPLEPGO: call{{.*}}baz 31 // SAMPLEPGO: call{{.*}}baz 32 // THINLTO: call{{.*}}baz 33 // THINLTO-NOT: call{{.*}}baz 34 void unroll() { 35 for (int i = 0; i < 2; i++) 36 baz(i); 37 } 38 39 // Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo. 40 // SAMPLEPGO-LABEL: define void @icp 41 // THINLTO-LABEL: define void @icp 42 // SAMPLEPGO: if.true.direct_targ 43 // FIXME: the following condition needs to be reversed once 44 // LTOPreLinkDefaultPipeline is customized. 45 // THINLTO-NOT: if.true.direct_targ 46 void icp(void (*p)()) { 47 p(); 48 } 49