diff options
author | Marco Castelluccio <mcastelluccio@mozilla.com> | 2018-07-13 13:01:43 +0000 |
---|---|---|
committer | Marco Castelluccio <mcastelluccio@mozilla.com> | 2018-07-13 13:01:43 +0000 |
commit | d47bde0d7a8bff7ef1526cc13b05b1d633550e32 (patch) | |
tree | 444ce3f770b3e91de52663626c1f382d015a8fee /compiler-rt/test/profile | |
parent | 8c1190982638b1cc6e17a21766c12743a4349b2f (diff) | |
download | bcm5719-llvm-d47bde0d7a8bff7ef1526cc13b05b1d633550e32.tar.gz bcm5719-llvm-d47bde0d7a8bff7ef1526cc13b05b1d633550e32.zip |
Add a test with multiple BBs on the same line
Test for https://bugs.llvm.org/show_bug.cgi?id=38065.
llvm-svn: 336996
Diffstat (limited to 'compiler-rt/test/profile')
3 files changed, 67 insertions, 0 deletions
diff --git a/compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c b/compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c new file mode 100644 index 00000000000..a2e187b5cb6 --- /dev/null +++ b/compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c @@ -0,0 +1,20 @@ +int main(void) +{ + int var; + + int a = 1; + if (a) { + var++; + } + + if (a) {} + + int b = 0; + if (b) { + var++; + } + + if (b) {} + + return 0; +} diff --git a/compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov b/compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov new file mode 100644 index 00000000000..92532af3067 --- /dev/null +++ b/compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov @@ -0,0 +1,34 @@ +// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-multiple-bbs-single-line.c +// CHECK-NEXT: -: 0:Graph:instrprof-gcov-multiple-bbs-single-line.gcno +// CHECK-NEXT: -: 0:Data:instrprof-gcov-multiple-bbs-single-line.gcda +// CHECK-NEXT: -: 0:Runs:1 +// CHECK-NEXT: -: 0:Programs:1 +// CHECK-NEXT:function main called 1 returned 100% blocks executed 80% +// CHECK-NEXT: -: 1:int main(void) +// CHECK-NEXT: -: 2:{ +// CHECK-NEXT: -: 3: int var; +// CHECK-NEXT: -: 4: +// CHECK-NEXT: 1: 5: int a = 1; +// CHECK-NEXT: 1: 6: if (a) { +// CHECK-NEXT:branch 0 taken 1 +// CHECK-NEXT:branch 1 taken 0 +// CHECK-NEXT: 1: 7: var++; +// CHECK-NEXT: 1: 8: } +// CHECK-NEXT: -: 9: +// CHECK-NEXT: 1: 10: if (a) {} +// CHECK-NEXT:branch 0 taken 1 +// CHECK-NEXT:branch 1 taken 0 +// CHECK-NEXT: -: 11: +// CHECK-NEXT: 1: 12: int b = 0; +// CHECK-NEXT: 1: 13: if (b) { +// CHECK-NEXT:branch 0 taken 0 +// CHECK-NEXT:branch 1 taken 1 +// CHECK-NEXT: #####: 14: var++; +// CHECK-NEXT: #####: 15: } +// CHECK-NEXT: -: 16: +// CHECK-NEXT: 1: 17: if (b) {} +// CHECK-NEXT:branch 0 taken 0 +// CHECK-NEXT:branch 1 taken 1 +// CHECK-NEXT: -: 18: +// CHECK-NEXT: 1: 19: return 0; +// CHECK-NEXT: -: 20:} diff --git a/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test b/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test new file mode 100644 index 00000000000..8839455189e --- /dev/null +++ b/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test @@ -0,0 +1,13 @@ +XFAIL: * + +RUN: mkdir -p %t.d +RUN: cd %t.d + +RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-multiple-bbs-single-line.c +RUN: test -f instrprof-gcov-multiple-bbs-single-line.gcno + +RUN: rm -f instrprof-gcov-multiple-bbs-single-line.gcda +RUN: %run %t +RUN: llvm-cov gcov -b -c instrprof-gcov-multiple-bbs-single-line.gcda +RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-multiple-bbs-single-line.c.gcov %S/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov +RUN: rm instrprof-gcov-multiple-bbs-single-line.gcda |