forked from OSchip/llvm-project
[PGO] Add a test case for infinite loops
Differential Revision: http://reviews.llvm.org/D40663 llvm-svn: 319463
This commit is contained in:
parent
c23d2c6883
commit
8b97870c44
|
@ -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]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue