[llvm-commits] [llvm] r89971 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/crash.ll test/Transforms/InstCombine/store.ll

Chris Lattner sabre at nondot.org
Thu Nov 26 14:04:42 PST 2009


Author: lattner
Date: Thu Nov 26 16:04:42 2009
New Revision: 89971

URL: http://llvm.org/viewvc/llvm-project?rev=89971&view=rev
Log:
Fix PR5471 by removing an instcombine xform.  Some pieces of the code
generates store to undef and some generates store to null as the idiom
for undefined behavior.  Since simplifycfg zaps both, don't remove the
undefined behavior in instcombine.

Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
    llvm/trunk/test/Transforms/InstCombine/crash.ll
    llvm/trunk/test/Transforms/InstCombine/store.ll

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=89971&r1=89970&r2=89971&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Nov 26 16:04:42 2009
@@ -12096,12 +12096,6 @@
   Value *Val = SI.getOperand(0);
   Value *Ptr = SI.getOperand(1);
 
-  if (isa<UndefValue>(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 

Modified: llvm/trunk/test/Transforms/InstCombine/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/crash.ll?rev=89971&r1=89970&r2=89971&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/crash.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/crash.ll Thu Nov 26 16:04:42 2009
@@ -125,3 +125,15 @@
   %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
+}

Modified: llvm/trunk/test/Transforms/InstCombine/store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/store.ll?rev=89971&r1=89970&r2=89971&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/store.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/store.ll Thu Nov 26 16:04:42 2009
@@ -6,6 +6,7 @@
         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
 }





More information about the llvm-commits mailing list