summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitd70cf1d5ae5eec05215897855f8370e04ded9a2b (patch)
treefe1d08189f12793fc3ad27eb85f33eadc412de75 /llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
parentd4c8cbd776ac5913b0b9bcf21894186b178062ad (diff)
downloadbcm5719-llvm-d70cf1d5ae5eec05215897855f8370e04ded9a2b.tar.gz
bcm5719-llvm-d70cf1d5ae5eec05215897855f8370e04ded9a2b.zip
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. llvm-svn: 54132
Diffstat (limited to 'llvm/lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/MemoryDependenceAnalysis.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 2012ab473c9..c93a680382e 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/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 ) &&
OpenPOWER on IntegriCloud