Don't delete volatile loads. Doing so is not safe.
authorOwen Anderson <resistor@mac.com>
Mon, 23 Jul 2007 22:05:54 +0000 (22:05 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 23 Jul 2007 22:05:54 +0000 (22:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40448 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/FastDLE.cpp

index 001f834b5f0bdb80ef28b76ff857abc0a6484912..74712ad83fe0f6a41c1aa0f232f4c5b73e78d3b8 100644 (file)
@@ -69,6 +69,12 @@ bool FDLE::runOnBasicBlock(BasicBlock &BB) {
   for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); BBI != BBE; ++BBI) {
     // If we find a store or a free...
     if (LoadInst* L = dyn_cast<LoadInst>(BBI)) {
+      // We can't delete volatile loads
+      if (L->isVolatile()) {
+        lastLoad[L->getPointerOperand()] = L;
+        continue;
+      }
+      
       Value* pointer = L->getPointerOperand();
       LoadInst*& last = lastLoad[pointer];