[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:32 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL319463: [PGO] Add a test case for infinite loops (authored by davidxl).

Changed prior to commit:
  https://reviews.llvm.org/D40663?vs=124966&id=124982#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40663

Files:
  compiler-rt/trunk/test/profile/infinite_loop.c


Index: compiler-rt/trunk/test/profile/infinite_loop.c
===================================================================
--- compiler-rt/trunk/test/profile/infinite_loop.c
+++ compiler-rt/trunk/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.124982.patch
Type: text/x-patch
Size: 727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171130/6209d952/attachment.bin>


More information about the llvm-commits mailing list