Fix an issue where, under very specific circumstances, memdep could end up dereferenc...
authorOwen Anderson <resistor@mac.com>
Wed, 30 Jan 2008 01:24:05 +0000 (01:24 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 30 Jan 2008 01:24:05 +0000 (01:24 +0000)
of one of its internal maps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46541 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/MemoryDependenceAnalysis.cpp

index eea0615ce31bfa6105e23d7c6e06106c1419bf7e..445e16dbb31eb940a3a53a50b89808c7a06c921f 100644 (file)
@@ -451,8 +451,6 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction* rem) {
   // Figure out the new dep for things that currently depend on rem
   Instruction* newDep = NonLocal;
 
-  reverseDep[depGraphLocal[rem].first].erase(rem);
-
   for (DenseMap<BasicBlock*, Value*>::iterator DI =
        depGraphNonLocal[rem].begin(), DE = depGraphNonLocal[rem].end();
        DI != DE; ++DI)
@@ -462,6 +460,8 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction* rem) {
   depMapType::iterator depGraphEntry = depGraphLocal.find(rem);
 
   if (depGraphEntry != depGraphLocal.end()) {
+    reverseDep[depGraphLocal[rem].first].erase(rem);
+    
     if (depGraphEntry->second.first != NonLocal &&
         depGraphEntry->second.second) {
       // If we have dep info for rem, set them to it