summaryrefslogtreecommitdiff
path: root/test/profile
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-09-11 18:38:34 +0000
committerVedant Kumar <vsk@apple.com>2018-09-11 18:38:34 +0000
commit7da037031808abaad3e9e73edb326a5ae8d22068 (patch)
tree3ee39ed1156d4a7d6c40aa0ae4ef6b339149e26c /test/profile
parentd2e706f3357bbb9faa3ac9c051f8b58fcfd456b0 (diff)
downloadcompiler-rt-7da037031808abaad3e9e73edb326a5ae8d22068.tar.gz
[gcov] Fix branch counters with switch statements (fix PR38821)
Right now, the counters are added in regards of the number of successors for a given BasicBlock: it's good when we've only 1 or 2 successors (at least with BranchInstr). But in the case of a switch statement, the BasicBlock after switch has several predecessors and we need know from which BB we're coming from. So the idea is to revert what we're doing: add a PHINode in each block which will select the counter according to the incoming BB. They're several pros for doing that: - we fix the "switch" bug - we remove the function call to "__llvm_gcov_indirect_counter_increment" and the lookup table stuff - we replace by PHINodes, so the optimizer will probably makes a better job. Patch by calixte! Differential Revision: https://reviews.llvm.org/D51619 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile')
-rw-r--r--test/profile/Inputs/instrprof-gcov-switch1.c.gcov4
-rw-r--r--test/profile/Inputs/instrprof-gcov-switch2.c.gcov4
2 files changed, 4 insertions, 4 deletions
diff --git a/test/profile/Inputs/instrprof-gcov-switch1.c.gcov b/test/profile/Inputs/instrprof-gcov-switch1.c.gcov
index 7d136dc98..f19431e17 100644
--- a/test/profile/Inputs/instrprof-gcov-switch1.c.gcov
+++ b/test/profile/Inputs/instrprof-gcov-switch1.c.gcov
@@ -5,9 +5,9 @@
// CHECK-NEXT: -: 0:Programs:1
// CHECK-NEXT: -: 1:int main(void)
// CHECK-NEXT: -: 2:{
-// CHECK-NEXT: 2: 3: int i = 22;
+// CHECK-NEXT: 1: 3: int i = 22;
// CHECK-NEXT: -: 4:
-// CHECK-NEXT: 2: 5: switch (i) {
+// CHECK-NEXT: 1: 5: switch (i) {
// CHECK-NEXT: -: 6: case 7:
// CHECK-NEXT: #####: 7: break;
// CHECK-NEXT: -: 8:
diff --git a/test/profile/Inputs/instrprof-gcov-switch2.c.gcov b/test/profile/Inputs/instrprof-gcov-switch2.c.gcov
index 67f408606..0b85e0f50 100644
--- a/test/profile/Inputs/instrprof-gcov-switch2.c.gcov
+++ b/test/profile/Inputs/instrprof-gcov-switch2.c.gcov
@@ -5,9 +5,9 @@
// CHECK-NEXT: -: 0:Programs:1
// CHECK-NEXT: -: 1:int main(void)
// CHECK-NEXT: -: 2:{
-// CHECK-NEXT: 3: 3: int i = 22;
+// CHECK-NEXT: 1: 3: int i = 22;
// CHECK-NEXT: -: 4:
-// CHECK-NEXT: 3: 5: switch (i) {
+// CHECK-NEXT: 1: 5: switch (i) {
// CHECK-NEXT: -: 6: case 7:
// CHECK-NEXT: #####: 7: break;
// CHECK-NEXT: -: 8: