]> granicus.if.org Git - clang/commitdiff
Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile...
authorDehao Chen <dehao@google.com>
Thu, 23 Mar 2017 21:20:17 +0000 (21:20 +0000)
committerDehao Chen <dehao@google.com>
Thu, 23 Mar 2017 21:20:17 +0000 (21:20 +0000)
Summary: This is the test added for https://reviews.llvm.org/D31217

Reviewers: tejohnson, mehdi_amini

Reviewed By: tejohnson

Subscribers: cfe-commits, Prazek

Differential Revision: https://reviews.llvm.org/D31219

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298647 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
test/CodeGen/pgo-sample-thinlto-summary.c

index b4ef47d179668ceea285be44259f5e149e612318..d3680dc1f724dd9e05c44ddfeeb6cf77f39c68c2 100644 (file)
@@ -1,2 +1,4 @@
 bar:100:100
  2: 2000 foo:2000
+icp:100:100
+ 1: 1000 unroll:1000
index cb45ea45ee0200b40a940c457e4a095975736f24..a284af3c80877ad3d88bf7806218b6770e4d8def 100644 (file)
@@ -1,5 +1,5 @@
-// 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
+// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=O2
+// 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
 // Checks if hot call is inlined by normal compile, but not inlined by
 // thinlto compile.
 
@@ -11,9 +11,32 @@ void foo(int n) {
     g += baz(i);
 }
 
-// INLINE-NOT: call{{.*}}foo
-// NOINLINE: call{{.*}}foo
+// O2-LABEL: define void @bar
+// THINLTO-LABEL: define void @bar
+// O2-NOT: call{{.*}}foo
+// THINLTO: call{{.*}}foo
 void bar(int n) {
   for (int i = 0; i < n; i++)
     foo(i);
 }
+
+// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
+// O2-LABEL: define void @unroll
+// THINLTO-LABEL: define void @unroll
+// O2: call{{.*}}baz
+// O2: call{{.*}}baz
+// THINLTO: call{{.*}}baz
+// THINLTO-NOT: call{{.*}}baz
+void unroll() {
+  for (int i = 0; i < 2; i++)
+    baz(i);
+}
+
+// Checks if icp is invoked by normal compile, but not thinlto compile.
+// O2-LABEL: define void @icp
+// THINLTO-LABEL: define void @icp
+// O2: if.true.direct_targ
+// ThinLTO-NOT: if.true.direct_targ
+void icp(void (*p)()) {
+  p();
+}