diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/DeadStoreElimination.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index f9d1205..89afa91 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -326,9 +326,9 @@ bool DSE::handleEndBlock(BasicBlock& BB, // If we encounter a use of the pointer, it is no longer considered dead if (LoadInst* L = dyn_cast<LoadInst>(BBI)) { - // However, if this load is unused, we can go ahead and remove it, and - // not have to worry about it making our pointer undead! - if (L->use_empty()) { + // However, if this load is unused and not volatile, we can go ahead and remove it, + // and not have to worry about it making our pointer undead! + if (L->use_empty() && !L->isVolatile()) { MD.removeInstruction(L); // DCE instructions only used to calculate that load |