aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/MemoryDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-07-28 16:00:58 +0000
committerOwen Anderson <resistor@mac.com>2008-07-28 16:00:58 +0000
commitd4310a5d41cc13f109890f5efbb19e084fecb27a (patch)
tree52e9e803e579b6906c521d8baa134b82310a9b83 /lib/Analysis/MemoryDependenceAnalysis.cpp
parent1a53eadbffb089de517071e575152c0cbe39b7c9 (diff)
downloadexternal_llvm-d4310a5d41cc13f109890f5efbb19e084fecb27a.zip
external_llvm-d4310a5d41cc13f109890f5efbb19e084fecb27a.tar.gz
external_llvm-d4310a5d41cc13f109890f5efbb19e084fecb27a.tar.bz2
Fix a subtle bug when removing instructions from memdep. In very specific
circumstances we could end up remapping a dependee to the same instruction that we're trying to remove. Handle this properly by just falling back to a conservative solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index 2012ab4..c93a680 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -528,6 +528,10 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction* rem) {
// If we have dep info for rem, set them to it
BasicBlock::iterator RI = depGraphEntry->second.first;
RI++;
+
+ // If RI is rem, then we use rem's immediate successor.
+ if (RI == (BasicBlock::iterator)rem) RI++;
+
newDep = RI;
} else if ( (depGraphEntry->second.first == NonLocal ||
depGraphEntry->second.first == None ) &&