From: Bruno Cardoso Lopes Date: Thu, 20 Aug 2015 18:24:54 +0000 (+0000) Subject: [LVI] Avoid iterator invalidation in LazyValueInfoCache::threadEdge X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=4d9e28f0824a2d59cecfe4e6ab7d9b01c7383e3a [LVI] Avoid iterator invalidation in LazyValueInfoCache::threadEdge Do that by copying out the elements to another SmallPtrSet. Follow up from r245309. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245590 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp index a984bc40ac1..4fb6b105646 100644 --- a/lib/Analysis/LazyValueInfo.cpp +++ b/lib/Analysis/LazyValueInfo.cpp @@ -1055,7 +1055,7 @@ void LazyValueInfoCache::threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc, auto I = OverDefinedCache.find(OldSucc); if (I == OverDefinedCache.end()) return; // Nothing to process here. - SmallPtrSetImpl &ClearSet = I->second; + SmallPtrSet 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