summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-03-21 19:55:46 +0000
committerDehao Chen <dehao@google.com>2017-03-21 19:55:46 +0000
commitce39fdd6eeabc4a007ce7821a247cc58b816e0d7 (patch)
tree7200144abac154c851d63104e6a5723a989fbda7 /clang/test
parent9907e9d860051d80b81fc2a0e9ddcb0ee98d5c72 (diff)
downloadbcm5719-llvm-ce39fdd6eeabc4a007ce7821a247cc58b816e0d7.tar.gz
bcm5719-llvm-ce39fdd6eeabc4a007ce7821a247cc58b816e0d7.zip
Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.
Summary: Because SamplePGO passes will be invoked twice in ThinLTO build: once at compile phase, the other at backend. We want to make sure the IR at the 2nd phase matches the hot part in pro file, thus we do not want to inline hot callsites in the first phase. Reviewers: tejohnson, eraman Reviewed By: tejohnson Subscribers: mehdi_amini, cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D31202 llvm-svn: 298429
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof2
-rw-r--r--clang/test/CodeGen/pgo-sample-thinlto-summary.c19
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof b/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
new file mode 100644
index 00000000000..b4ef47d1796
--- /dev/null
+++ b/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
@@ -0,0 +1,2 @@
+bar:100:100
+ 2: 2000 foo:2000
diff --git a/clang/test/CodeGen/pgo-sample-thinlto-summary.c b/clang/test/CodeGen/pgo-sample-thinlto-summary.c
new file mode 100644
index 00000000000..cb45ea45ee0
--- /dev/null
+++ b/clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=INLINE
+// 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=NOINLINE
+// 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);
+}
+
+// INLINE-NOT: call{{.*}}foo
+// NOINLINE: call{{.*}}foo
+void bar(int n) {
+ for (int i = 0; i < n; i++)
+ foo(i);
+}
OpenPOWER on IntegriCloud