From 916ba45c62adcdd46f2bd69d2ff5e319d88616de Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Sat, 25 Oct 2014 19:59:30 +0000 Subject: [PATCH 1/1] LSR: Minor cleanup after Daniel's patch. Combine the Inserted an Done sets into a Visited set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220623 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index e1d18e8f99b..9ef9b05639a 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3116,14 +3116,13 @@ bool LSRInstance::InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F) { void LSRInstance::CollectLoopInvariantFixupsAndFormulae() { SmallVector Worklist(RegUses.begin(), RegUses.end()); - SmallPtrSet Inserted; - SmallPtrSet Done; + SmallPtrSet Visited; while (!Worklist.empty()) { const SCEV *S = Worklist.pop_back_val(); // Don't process the same SCEV twice - if (!Done.insert(S)) + if (!Visited.insert(S)) continue; if (const SCEVNAryExpr *N = dyn_cast(S)) @@ -3134,7 +3133,6 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() { Worklist.push_back(D->getLHS()); Worklist.push_back(D->getRHS()); } else if (const SCEVUnknown *US = dyn_cast(S)) { - if (!Inserted.insert(US)) continue; const Value *V = US->getValue(); if (const Instruction *Inst = dyn_cast(V)) { // Look for instructions defined outside the loop. -- 2.34.1