mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[Scalarizer] When gathering scattered scalar, don't replace it with itself
The (previously-crashing) test-case would cause us to seemingly-harmlessly replace some use with something else, but we can't replace it with itself, so we would crash.
This commit is contained in:
parent
28e2081c60
commit
8dc7c350a2
@ -944,6 +944,8 @@ bool ScalarizerVisitor::finish() {
|
||||
} else {
|
||||
assert(CV.size() == 1 && Op->getType() == CV[0]->getType());
|
||||
Res = CV[0];
|
||||
if (Op == Res)
|
||||
continue;
|
||||
}
|
||||
Res->takeName(Op);
|
||||
Op->replaceAllUsesWith(Res);
|
||||
|
@ -22,3 +22,32 @@ bb3:
|
||||
ret void
|
||||
}
|
||||
|
||||
; See https://reviews.llvm.org/D83101#2135945
|
||||
define void @f1_crash(<2 x i16> %base, i1 %c, <2 x i16>* %ptr) {
|
||||
; CHECK-LABEL: @f1_crash(
|
||||
; CHECK: vector.ph:
|
||||
; CHECK: %base.i0 = extractelement <2 x i16> %base, i32 0
|
||||
; CHECK: %base.i1 = extractelement <2 x i16> %base, i32 1
|
||||
; CHECK: br label %vector.body115
|
||||
; CHECK: vector.body115: ; preds = %vector.body115, %vector.ph
|
||||
; CHECK: %vector.recur.i0 = phi i16 [ %base.i0, %vector.ph ], [ %wide.load125.i0, %vector.body115 ]
|
||||
; CHECK: %vector.recur.i1 = phi i16 [ %base.i1, %vector.ph ], [ %wide.load125.i1, %vector.body115 ]
|
||||
; CHECK: %wide.load125 = load <2 x i16>, <2 x i16>* %ptr, align 1
|
||||
; CHECK: %wide.load125.i0 = extractelement <2 x i16> %wide.load125, i32 0
|
||||
; CHECK: %wide.load125.i1 = extractelement <2 x i16> %wide.load125, i32 1
|
||||
; CHECK: br i1 %c, label %middle.block113, label %vector.body115
|
||||
; CHECK: middle.block113: ; preds = %vector.body115
|
||||
; CHECK: ret void
|
||||
; CHECK: }
|
||||
|
||||
vector.ph:
|
||||
br label %vector.body115
|
||||
|
||||
vector.body115:
|
||||
%vector.recur = phi <2 x i16> [ %base, %vector.ph ], [ %wide.load125, %vector.body115 ]
|
||||
%wide.load125 = load <2 x i16>, <2 x i16>* %ptr, align 1
|
||||
br i1 %c, label %middle.block113, label %vector.body115
|
||||
|
||||
middle.block113:
|
||||
ret void
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user