SimplifyCFG fix for volatile load/store.
[oota-llvm.git] / lib / Transforms / Utils / SimplifyCFG.cpp
index a63d31d5af5a100e4a8fa9f0832e581cf44e29c0..a5c5c22aa5ab41f24f1ccae0143f9c2e78db9849 100644 (file)
@@ -3944,11 +3944,13 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I) {
 
     // Load from null is undefined.
     if (LoadInst *LI = dyn_cast<LoadInst>(Use))
-      return LI->getPointerAddressSpace() == 0;
+      if (!LI->isVolatile())
+        return LI->getPointerAddressSpace() == 0;
 
     // Store to null is undefined.
     if (StoreInst *SI = dyn_cast<StoreInst>(Use))
-      return SI->getPointerAddressSpace() == 0 && SI->getPointerOperand() == I;
+      if (!SI->isVolatile())
+        return SI->getPointerAddressSpace() == 0 && SI->getPointerOperand() == I;
   }
   return false;
 }