[llvm-commits] [llvm] r50390 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-04-28-VolatileStore.ll

Chris Lattner sabre at nondot.org
Mon Apr 28 21:58:39 PDT 2008


Author: lattner
Date: Mon Apr 28 23:58:38 2008
New Revision: 50390

URL: http://llvm.org/viewvc/llvm-project?rev=50390&view=rev
Log:
don't delete the last store to an alloca if the store is volatile.

Added:
    llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 28 23:58:38 2008
@@ -10311,7 +10311,7 @@
   
   // If the RHS is an alloca with a single use, zapify the store, making the
   // alloca dead.
-  if (Ptr->hasOneUse()) {
+  if (Ptr->hasOneUse() && !SI.isVolatile()) {
     if (isa<AllocaInst>(Ptr)) {
       EraseInstFromFunction(SI);
       ++NumCombined;

Added: llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll?rev=50390&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll Mon Apr 28 23:58:38 2008
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store}
+
+define void @test() {
+	%votf = alloca <4 x float>		; <<4 x float>*> [#uses=1]
+	volatile store <4 x float> zeroinitializer, <4 x float>* %votf, align 16
+	ret void
+}
+





More information about the llvm-commits mailing list