SimplifyCFG: don't turn volatile stores to null/undef into unreachable. Fixes PR7369.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 13 Jun 2010 14:35:54 +0000 (14:35 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 13 Jun 2010 14:35:54 +0000 (14:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105914 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SimplifyCFGPass.cpp

index 97441008c46c74c408a1ec4d43311f0435f99d41..49d93a2fcc271a6ad12ca5036ccf437a67e46469 100644 (file)
@@ -137,6 +137,9 @@ static bool MarkAliveBlocks(BasicBlock *BB,
       // they should be changed to unreachable by passes that can't modify the
       // CFG.
       if (StoreInst *SI = dyn_cast<StoreInst>(BBI)) {
+        // Don't touch volatile stores.
+        if (SI->isVolatile()) continue;
+
         Value *Ptr = SI->getOperand(1);
         
         if (isa<UndefValue>(Ptr) ||