don't bother touching volatile stores, they will just return clobber on
authorChris Lattner <sabre@nondot.org>
Sun, 7 Dec 2008 00:25:15 +0000 (00:25 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 7 Dec 2008 00:25:15 +0000 (00:25 +0000)
everything interesting anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60640 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/DeadStoreElimination.cpp

index 92431c3fe317bc4fd73b70b823ece717d7663b2f..8b40da656eed3418a6bb5524320d7b2e5c0a9a93 100644 (file)
@@ -90,6 +90,11 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
     // If we find a store or a free, get it's memory dependence.
     if (!isa<StoreInst>(Inst) && !isa<FreeInst>(Inst))
       continue;
+    
+    // Don't molest volatile stores or do queries that will return "clobber".
+    if (StoreInst *SI = dyn_cast<StoreInst>(Inst))
+      if (SI->isVolatile())
+        continue;
 
     MemDepResult InstDep = MD.getDependency(Inst);