diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 670dd1162bd..f997d60a85e 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -12096,12 +12096,6 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) { Value *Val = SI.getOperand(0); Value *Ptr = SI.getOperand(1); - if (isa(Ptr)) { // store X, undef -> noop (even if volatile) - EraseInstFromFunction(SI); - ++NumCombined; - return 0; - } - // If the RHS is an alloca with a single use, zapify the store, making the // alloca dead. // If the RHS is an alloca with a two uses, the other one being a diff --git a/test/Transforms/InstCombine/crash.ll b/test/Transforms/InstCombine/crash.ll index fbac472e197..1528f6ddf3c 100644 --- a/test/Transforms/InstCombine/crash.ll +++ b/test/Transforms/InstCombine/crash.ll @@ -125,3 +125,15 @@ l10: %v11 = select i1 %v5_, i64 0, i64 %v6 ret i64 %v11 } + +; PR5471 +define arm_apcscc i32 @test5a() { + ret i32 0 +} + +define arm_apcscc void @test5() { + store i1 true, i1* undef + %1 = invoke i32 @test5a() to label %exit unwind label %exit +exit: + ret void +} diff --git a/test/Transforms/InstCombine/store.ll b/test/Transforms/InstCombine/store.ll index 314441eb865..64460d7a6d6 100644 --- a/test/Transforms/InstCombine/store.ll +++ b/test/Transforms/InstCombine/store.ll @@ -6,6 +6,7 @@ define void @test1(i32* %P) { store i32 124, i32* null ret void ; CHECK: @test1( +; CHECK-NEXT: store i32 123, i32* undef ; CHECK-NEXT: store i32 undef, i32* null ; CHECK-NEXT: ret void }