2017-06-28 01:45:40 +08:00
|
|
|
// 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
|
2017-03-24 05:20:17 +08:00
|
|
|
// 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
|
2017-06-30 07:33:13 +08:00
|
|
|
// 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
|
2017-07-08 04:53:17 +08:00
|
|
|
// 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
|
2017-03-22 03:55:46 +08:00
|
|
|
// Checks if hot call is inlined by normal compile, but not inlined by
|
|
|
|
// thinlto compile.
|
|
|
|
|
|
|
|
int baz(int);
|
|
|
|
int g;
|
|
|
|
|
|
|
|
void foo(int n) {
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
g += baz(i);
|
|
|
|
}
|
|
|
|
|
2018-02-24 03:30:48 +08:00
|
|
|
// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
|
|
|
|
// THINLTO-LABEL: define {{(dso_local )?}}void @bar
|
2017-06-28 01:45:40 +08:00
|
|
|
// SAMPLEPGO-NOT: call{{.*}}foo
|
2017-03-24 05:20:17 +08:00
|
|
|
// THINLTO: call{{.*}}foo
|
2017-03-22 03:55:46 +08:00
|
|
|
void bar(int n) {
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
foo(i);
|
|
|
|
}
|
2017-03-24 05:20:17 +08:00
|
|
|
|
|
|
|
// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
|
2018-02-24 03:30:48 +08:00
|
|
|
// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
|
|
|
|
// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
|
2017-06-28 01:45:40 +08:00
|
|
|
// SAMPLEPGO: call{{.*}}baz
|
|
|
|
// SAMPLEPGO: call{{.*}}baz
|
2017-03-24 05:20:17 +08:00
|
|
|
// THINLTO: call{{.*}}baz
|
|
|
|
// THINLTO-NOT: call{{.*}}baz
|
|
|
|
void unroll() {
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
baz(i);
|
|
|
|
}
|
|
|
|
|
2017-06-28 01:45:40 +08:00
|
|
|
// Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo.
|
2018-02-24 03:30:48 +08:00
|
|
|
// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
|
|
|
|
// THINLTO-LABEL: define {{(dso_local )?}}void @icp
|
2017-06-28 01:45:40 +08:00
|
|
|
// SAMPLEPGO: if.true.direct_targ
|
2017-06-30 07:33:13 +08:00
|
|
|
// FIXME: the following condition needs to be reversed once
|
|
|
|
// LTOPreLinkDefaultPipeline is customized.
|
|
|
|
// THINLTO-NOT: if.true.direct_targ
|
2017-03-24 05:20:17 +08:00
|
|
|
void icp(void (*p)()) {
|
|
|
|
p();
|
|
|
|
}
|