[llvm] r245590 - [LVI] Avoid iterator invalidation in LazyValueInfoCache::threadEdge

Bruno Cardoso Lopes via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 11:24:54 PDT 2015


Author: bruno
Date: Thu Aug 20 13:24:54 2015
New Revision: 245590

URL: http://llvm.org/viewvc/llvm-project?rev=245590&view=rev
Log:
[LVI] Avoid iterator invalidation in LazyValueInfoCache::threadEdge

Do that by copying out the elements to another SmallPtrSet.
Follow up from r245309.

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=245590&r1=245589&r2=245590&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Thu Aug 20 13:24:54 2015
@@ -1055,7 +1055,7 @@ void LazyValueInfoCache::threadEdge(Basi
   auto I = OverDefinedCache.find(OldSucc);
   if (I == OverDefinedCache.end())
     return; // Nothing to process here.
-  SmallPtrSetImpl<Value *> &ClearSet = I->second;
+  SmallPtrSet<Value *, 4> ClearSet(I->second.begin(), I->second.end());
 
   // Use a worklist to perform a depth-first search of OldSucc's successors.
   // NOTE: We do not need a visited list since any blocks we have already




More information about the llvm-commits mailing list