[PATCH] D40663: Add a test that infinite loop has profile properly collected.
David Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 11:38:31 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT319463: [PGO] Add a test case for infinite loops (authored by davidxl).
Repository:
rL LLVM
https://reviews.llvm.org/D40663
Files:
test/profile/infinite_loop.c
Index: test/profile/infinite_loop.c
===================================================================
--- test/profile/infinite_loop.c
+++ test/profile/infinite_loop.c
@@ -0,0 +1,30 @@
+// RUN: %clang_pgogen -O2 -o %t %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s
+
+void exit(int);
+int g;
+__attribute__((noinline)) void foo()
+{
+ g++;
+ if (g==1000)
+ exit(0);
+}
+
+
+int main()
+{
+ while (1) {
+ foo();
+ }
+
+}
+
+// CHECK: Counters:
+// CHECK-NEXT: main:
+// CHECK-NEXT: Hash: {{.*}}
+// CHECK-NEXT: Counters: 1
+// CHECK-NEXT: Block counts: [1000]
+
+
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40663.124981.patch
Type: text/x-patch
Size: 673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171130/d2ca8365/attachment.bin>
More information about the llvm-commits
mailing list