[llvm-commits] [llvm] r111210 - /llvm/trunk/lib/Analysis/LazyValueInfo.cpp

Owen Anderson resistor at mac.com
Mon Aug 16 16:42:33 PDT 2010


Author: resistor
Date: Mon Aug 16 18:42:33 2010
New Revision: 111210

URL: http://llvm.org/viewvc/llvm-project?rev=111210&view=rev
Log:
Fix another iterator invalidation that caused a *really* nasty miscompilation in 403.gcc.

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

Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=111210&r1=111209&r2=111210&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Mon Aug 16 18:42:33 2010
@@ -379,7 +379,7 @@
     LVILatticeVal getEdgeValue(BasicBlock *FromBB, BasicBlock *ToBB);
 
   private:
-    LVILatticeVal &getCachedEntryForBlock(BasicBlock *BB);
+    LVILatticeVal getCachedEntryForBlock(BasicBlock *BB);
   };
 } // end anonymous namespace
 
@@ -402,14 +402,14 @@
 
 /// getCachedEntryForBlock - See if we already have a value for this block.  If
 /// so, return it, otherwise create a new entry in the Cache map to use.
-LVILatticeVal &LVIQuery::getCachedEntryForBlock(BasicBlock *BB) {
+LVILatticeVal LVIQuery::getCachedEntryForBlock(BasicBlock *BB) {
   NewBlockInfo.insert(BB);
   return Cache[BB];
 }
 
 LVILatticeVal LVIQuery::getBlockValue(BasicBlock *BB) {
   // See if we already have a value for this block.
-  LVILatticeVal &BBLV = getCachedEntryForBlock(BB);
+  LVILatticeVal BBLV = getCachedEntryForBlock(BB);
   
   // If we've already computed this block's value, return it.
   if (!BBLV.isUndefined()) {
@@ -421,6 +421,7 @@
   // lattice value to overdefined, so that cycles will terminate and be
   // conservatively correct.
   BBLV.markOverdefined();
+  Cache[BB] = BBLV;
   
   // If V is live into BB, see if our predecessors know anything about it.
   Instruction *BBI = dyn_cast<Instruction>(Val);
@@ -453,7 +454,7 @@
     
     // Return the merged value, which is more precise than 'overdefined'.
     assert(!Result.isOverdefined());
-    return getCachedEntryForBlock(BB) = Result;
+    return Cache[BB] = Result;
   }
   
   // If this value is defined by an instruction in this block, we have to
@@ -478,7 +479,7 @@
     
     // Return the merged value, which is more precise than 'overdefined'.
     assert(!Result.isOverdefined());
-    return getCachedEntryForBlock(BB) = Result;
+    Cache[BB] = Result;
 
   } else {
     
@@ -489,7 +490,7 @@
 
   LVILatticeVal Result;
   Result.markOverdefined();
-  return getCachedEntryForBlock(BB) = Result;
+  return Result;
 }
 
 





More information about the llvm-commits mailing list