aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commit4c268c6241471b095206ae4d4f8211954a2ddd22 (patch)
tree76709b13e649e24eebeeff8ecfc6220b467ca3bf /lib
parente611b59c705ca8160bd77a8d9af3e4e8d7c10d9e (diff)
downloadexternal_llvm-4c268c6241471b095206ae4d4f8211954a2ddd22.zip
external_llvm-4c268c6241471b095206ae4d4f8211954a2ddd22.tar.gz
external_llvm-4c268c6241471b095206ae4d4f8211954a2ddd22.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')
-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