don't delete the last store to an alloca if the store is volatile.

llvm-svn: 50390
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 655ab10..c707e6e 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -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;
diff --git a/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll b/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
new file mode 100644
index 0000000..9bfe7aa
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
@@ -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
+}
+