| 1 |
// RUN: %clang_cc1 -fdebug-pass-manager -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 -fdebug-pass-manager -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 |
|
| 4 |
int baz(int); |
| 5 |
int g; |
| 6 |
|
| 7 |
void foo(int n) { |
| 8 |
for (int i = 0; i < n; i++) |
| 9 |
g += baz(i); |
| 10 |
} |
| 11 |
|
| 12 |
// Checks that loop unroll and icp are invoked by normal compile, but not thinlto compile. |
| 13 |
|
| 14 |
// SAMPLEPGO: Running pass: PGOIndirectCallPromotion on [module] |
| 15 |
// SAMPLEPGO: Running pass: LoopUnrollPass on bar |
| 16 |
|
| 17 |
// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module] |
| 18 |
// THINLTO-NOT: Running pass: LoopUnrollPass on bar |
| 19 |
|
| 20 |
// Checks if hot call is inlined by normal compile, but not inlined by |
| 21 |
// thinlto compile. |
| 22 |
// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar |
| 23 |
// THINLTO-LABEL: define {{(dso_local )?}}void @bar |
| 24 |
// SAMPLEPGO-NOT: call{{.*}}foo |
| 25 |
// THINLTO: call{{.*}}foo |
| 26 |
void bar(int n) { |
| 27 |
for (int i = 0; i < n; i++) |
| 28 |
foo(i); |
| 29 |
} |