[llvm-commits] [llvm] r46541 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Owen Anderson resistor at mac.com
Tue Jan 29 17:24:05 PST 2008


Author: resistor
Date: Tue Jan 29 19:24:05 2008
New Revision: 46541

URL: http://llvm.org/viewvc/llvm-project?rev=46541&view=rev
Log:
Fix an issue where, under very specific circumstances, memdep could end up dereferencing the end
of one of its internal maps.

Modified:
    llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=46541&r1=46540&r2=46541&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Tue Jan 29 19:24:05 2008
@@ -451,8 +451,6 @@
   // 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 @@
   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





More information about the llvm-commits mailing list