[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 10:42:52 PST 2017


davidxl created this revision.
Herald added a subscriber: sanjoy.

Depend on D400662


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.124966.patch
Type: text/x-patch
Size: 673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171130/ce414384/attachment.bin>


More information about the llvm-commits mailing list