[compiler-rt] r319463 - [PGO] Add a test case for infinite loops
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 11:37:57 PST 2017
Author: davidxl
Date: Thu Nov 30 11:37:56 2017
New Revision: 319463
URL: http://llvm.org/viewvc/llvm-project?rev=319463&view=rev
Log:
[PGO] Add a test case for infinite loops
Differential Revision: http://reviews.llvm.org/D40663
Added:
compiler-rt/trunk/test/profile/infinite_loop.c
Added: compiler-rt/trunk/test/profile/infinite_loop.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/infinite_loop.c?rev=319463&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/infinite_loop.c (added)
+++ compiler-rt/trunk/test/profile/infinite_loop.c Thu Nov 30 11:37:56 2017
@@ -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]
+
+
+
More information about the llvm-commits
mailing list