aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/DeadStoreElimination.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-04-28 19:51:27 +0000
committerDan Gohman <gohman@apple.com>2008-04-28 19:51:27 +0000
commit00acf97feb2cba053a07505dfad9116ad09aae7a (patch)
tree76709b13e649e24eebeeff8ecfc6220b467ca3bf /lib/Transforms/Scalar/DeadStoreElimination.cpp
parentbeb5be03320f9bbe6a4a92b0c7e1e0ebf3ef865d (diff)
downloadexternal_llvm-00acf97feb2cba053a07505dfad9116ad09aae7a.zip
external_llvm-00acf97feb2cba053a07505dfad9116ad09aae7a.tar.gz
external_llvm-00acf97feb2cba053a07505dfad9116ad09aae7a.tar.bz2
Fix DSE to not eliminate volatile loads with no uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50370 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/DeadStoreElimination.cpp')
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp6
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