summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
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
commit8cb19d967f00f5a9466e6f0a8411b3dc6c0f304e (patch)
tree7175d4f99fe0f3a668907154103cff35d0b58a1e /llvm/lib/Transforms
parentadc322bb6d129b59dbfa5ecb5401d9017ee0986c (diff)
downloadbcm5719-llvm-8cb19d967f00f5a9466e6f0a8411b3dc6c0f304e.tar.gz
bcm5719-llvm-8cb19d967f00f5a9466e6f0a8411b3dc6c0f304e.zip
Fix DSE to not eliminate volatile loads with no uses.
llvm-svn: 50370
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index f9d1205ada5..89afa911e75 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud