From 0bd8066c868b8cea1c356876a941a1ff65024e21 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Sun, 16 Apr 2017 21:07:04 +0000 Subject: [PATCH] [LCSSA] Fix non-determinism due to iterating over a SmallPtrSet. Use a SmallSetVector instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300431 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/LCSSA.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index 49b4bd92faf..d2bf2062555 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/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 -- 2.50.1