summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-13 23:54:42 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-14 20:38:10 +0100
commit652cd7c1007aa5a13ad9864fadc939c5710c5199 (patch)
tree1d37766aea8c5632e572fe80001087a52a63fd77 /llvm/test/Transforms
parentfa632340938cc02e03262e1318cb06b34c32f5fe (diff)
downloadbcm5719-llvm-652cd7c1007aa5a13ad9864fadc939c5710c5199.tar.gz
bcm5719-llvm-652cd7c1007aa5a13ad9864fadc939c5710c5199.zip
[InstCombine] Fix user iterator invalidation in bitcast of phi transform
This fixes the issue encountered in D71164. Instead of using a range-based for, manually iterate over the users and advance the iterator beforehand, so we do not skip any users due to iterator invalidation. Differential Revision: https://reviews.llvm.org/D72657
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll b/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll
index d1af21f6c4d..d5489484bdd 100644
--- a/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll
+++ b/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll
@@ -8,16 +8,13 @@ define double @test(i1 %c, i64* %p) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[END:%.*]]
; CHECK: if:
-; CHECK-NEXT: [[LOAD:%.*]] = load i64, i64* bitcast (double* @Q to i64*), align 8
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64 [[LOAD]] to double
-; CHECK-NEXT: [[PHITMP:%.*]] = bitcast i64 [[LOAD]] to double
+; CHECK-NEXT: [[LOAD1:%.*]] = load double, double* @Q, align 8
; CHECK-NEXT: br label [[END]]
; CHECK: end:
-; CHECK-NEXT: [[TMP1:%.*]] = phi double [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[TMP0]], [[IF]] ]
-; CHECK-NEXT: [[PHI:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[PHITMP]], [[IF]] ]
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[P:%.*]] to double*
-; CHECK-NEXT: store double [[TMP1]], double* [[TMP2]], align 8
-; CHECK-NEXT: ret double [[PHI]]
+; CHECK-NEXT: [[TMP0:%.*]] = phi double [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[LOAD1]], [[IF]] ]
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to double*
+; CHECK-NEXT: store double [[TMP0]], double* [[TMP1]], align 8
+; CHECK-NEXT: ret double [[TMP0]]
;
entry:
br i1 %c, label %if, label %end
OpenPOWER on IntegriCloud