[PATCH] D31219: Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase.

Dehao Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 15:37:13 PDT 2017


danielcdh created this revision.
Herald added a subscriber: Prazek.

This is the test added for https://reviews.llvm.org/D31217


https://reviews.llvm.org/D31219

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


Index: test/CodeGen/pgo-sample-thinlto-summary.c
===================================================================
--- test/CodeGen/pgo-sample-thinlto-summary.c
+++ test/CodeGen/pgo-sample-thinlto-summary.c
@@ -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,30 @@
     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);
 }
+
+// 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);
+}
+
+// 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();
+}
Index: test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
===================================================================
--- test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
+++ test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
@@ -1,2 +1,4 @@
 bar:100:100
  2: 2000 foo:2000
+icp:100:100
+ 1: 1000 unroll:1000


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31219.92560.patch
Type: text/x-patch
Size: 1948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170321/3aafc7b9/attachment.bin>


More information about the cfe-commits mailing list