From: Davide Italiano Date: Sun, 16 Apr 2017 21:07:04 +0000 (+0000) Subject: [LCSSA] Fix non-determinism due to iterating over a SmallPtrSet. X-Git-Tag: llvmorg-5.0.0-rc1~7578 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd37c67d812e0770e0f82b7541b2af439cb9baca;p=platform%2Fupstream%2Fllvm.git [LCSSA] Fix non-determinism due to iterating over a SmallPtrSet. Use a SmallSetVector instead. llvm-svn: 300431 --- diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp index 49b4bd9..d2bf206 100644 --- a/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -241,7 +241,7 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl &Worklist, // Compute the set of BasicBlocks in the loop `L` dominating at least one exit. static void computeBlocksDominatingExits( Loop &L, DominatorTree &DT, SmallVector &ExitBlocks, - SmallPtrSet &BlocksDominatingExits) { + SmallSetVector &BlocksDominatingExits) { SmallVector BBWorklist; // We start from the exit blocks, as every block trivially dominates itself @@ -279,7 +279,7 @@ static void computeBlocksDominatingExits( if (!L.contains(IDomBB)) continue; - if (BlocksDominatingExits.insert(IDomBB).second) + if (BlocksDominatingExits.insert(IDomBB)) BBWorklist.push_back(IDomBB); } } @@ -293,7 +293,7 @@ bool llvm::formLCSSA(Loop &L, DominatorTree &DT, LoopInfo *LI, if (ExitBlocks.empty()) return false; - SmallPtrSet BlocksDominatingExits; + SmallSetVector BlocksDominatingExits; // We want to avoid use-scanning leveraging dominance informations. // If a block doesn't dominate any of the loop exits, the none of the values