[InstCombine] Don't remove non-terminator unreachable markers
Even if the value happens to be undef, we should preserve these so they get turned into an unreachable terminator later.
This commit is contained in:
parent
553cd1924d
commit
8aefa2bf39
@ -1559,6 +1559,10 @@ Instruction *InstCombinerImpl::visitStoreInst(StoreInst &SI) {
|
||||
return nullptr; // Do not modify these!
|
||||
}
|
||||
|
||||
// This is a non-terminator unreachable marker. Don't remove it.
|
||||
if (isa<UndefValue>(Ptr))
|
||||
return nullptr;
|
||||
|
||||
// store undef, Ptr -> noop
|
||||
// FIXME: This is technically incorrect because it might overwrite a poison
|
||||
// value. Change to PoisonValue once #52930 is resolved.
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
define void @ossfuzz_14169_test1(ptr %a0) {
|
||||
; CHECK-LABEL: @ossfuzz_14169_test1(
|
||||
; CHECK-NEXT: bb:
|
||||
; CHECK-NEXT: store ptr undef, ptr undef, align 8
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
bb:
|
||||
@ -23,6 +24,7 @@ bb:
|
||||
define void @ossfuzz_14169_test2(ptr %a0) {
|
||||
; CHECK-LABEL: @ossfuzz_14169_test2(
|
||||
; CHECK-NEXT: bb:
|
||||
; CHECK-NEXT: store ptr undef, ptr undef, align 8
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
bb:
|
||||
|
||||
@ -170,6 +170,7 @@ cond.end:
|
||||
define void @pr50370(i32 %x) {
|
||||
; CHECK-LABEL: @pr50370(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: store i32 poison, ptr undef, align 4
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
|
||||
@ -1301,6 +1301,7 @@ define void @main(i1 %cond, i16 %x) {
|
||||
; CHECK: g.exit:
|
||||
; CHECK-NEXT: br label [[FOR_COND]]
|
||||
; CHECK: for.end:
|
||||
; CHECK-NEXT: store double undef, ptr undef, align 8
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
|
||||
@ -67,6 +67,7 @@ define i32 @PR30366(i1 %a) {
|
||||
; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4857
|
||||
define i177 @ossfuzz_4857(i177 %X, i177 %Y) {
|
||||
; CHECK-LABEL: @ossfuzz_4857(
|
||||
; CHECK-NEXT: store i1 poison, ptr undef, align 1
|
||||
; CHECK-NEXT: ret i177 0
|
||||
;
|
||||
%B5 = udiv i177 %Y, -1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user