Dehao Chen | 874bc74 | 2017-06-27 17:45:40 +0000 | [diff] [blame] | 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 |
Dehao Chen | 1240bd3 | 2017-03-23 21:20:17 +0000 | [diff] [blame] | 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 |
Dehao Chen | 6d441bf | 2017-06-29 23:33:13 +0000 | [diff] [blame] | 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 |
Dehao Chen | 4a7e66a | 2017-07-07 20:53:17 +0000 | [diff] [blame] | 4 | // RUN: %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 |
Dehao Chen | ce39fdd | 2017-03-21 19:55:46 +0000 | [diff] [blame] | 5 | // Checks if hot call is inlined by normal compile, but not inlined by |
| 6 | // thinlto compile. |
| 7 | |
| 8 | int baz(int); |
| 9 | int g; |
| 10 | |
| 11 | void foo(int n) { |
| 12 | for (int i = 0; i < n; i++) |
| 13 | g += baz(i); |
| 14 | } |
| 15 | |
Rafael Espindola | 922f2aa | 2018-02-23 19:30:48 +0000 | [diff] [blame] | 16 | // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar |
| 17 | // THINLTO-LABEL: define {{(dso_local )?}}void @bar |
Dehao Chen | 874bc74 | 2017-06-27 17:45:40 +0000 | [diff] [blame] | 18 | // SAMPLEPGO-NOT: call{{.*}}foo |
Dehao Chen | 1240bd3 | 2017-03-23 21:20:17 +0000 | [diff] [blame] | 19 | // THINLTO: call{{.*}}foo |
Dehao Chen | ce39fdd | 2017-03-21 19:55:46 +0000 | [diff] [blame] | 20 | void bar(int n) { |
| 21 | for (int i = 0; i < n; i++) |
| 22 | foo(i); |
| 23 | } |
Dehao Chen | 1240bd3 | 2017-03-23 21:20:17 +0000 | [diff] [blame] | 24 | |
| 25 | // Checks if loop unroll is invoked by normal compile, but not thinlto compile. |
Rafael Espindola | 922f2aa | 2018-02-23 19:30:48 +0000 | [diff] [blame] | 26 | // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll |
| 27 | // THINLTO-LABEL: define {{(dso_local )?}}void @unroll |
Dehao Chen | 874bc74 | 2017-06-27 17:45:40 +0000 | [diff] [blame] | 28 | // SAMPLEPGO: call{{.*}}baz |
| 29 | // SAMPLEPGO: call{{.*}}baz |
Dehao Chen | 1240bd3 | 2017-03-23 21:20:17 +0000 | [diff] [blame] | 30 | // THINLTO: call{{.*}}baz |
| 31 | // THINLTO-NOT: call{{.*}}baz |
| 32 | void unroll() { |
| 33 | for (int i = 0; i < 2; i++) |
| 34 | baz(i); |
| 35 | } |
| 36 | |
Dehao Chen | 874bc74 | 2017-06-27 17:45:40 +0000 | [diff] [blame] | 37 | // Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo. |
Rafael Espindola | 922f2aa | 2018-02-23 19:30:48 +0000 | [diff] [blame] | 38 | // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp |
| 39 | // THINLTO-LABEL: define {{(dso_local )?}}void @icp |
Dehao Chen | 874bc74 | 2017-06-27 17:45:40 +0000 | [diff] [blame] | 40 | // SAMPLEPGO: if.true.direct_targ |
Dehao Chen | 6d441bf | 2017-06-29 23:33:13 +0000 | [diff] [blame] | 41 | // FIXME: the following condition needs to be reversed once |
| 42 | // LTOPreLinkDefaultPipeline is customized. |
| 43 | // THINLTO-NOT: if.true.direct_targ |
Dehao Chen | 1240bd3 | 2017-03-23 21:20:17 +0000 | [diff] [blame] | 44 | void icp(void (*p)()) { |
| 45 | p(); |
| 46 | } |