summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-10-25 19:59:30 +0000
committerAndrew Trick <atrick@apple.com>2014-10-25 19:59:30 +0000
commitdd925ad21830ee59c8a5fccde5e07e7156e91588 (patch)
tree92b00e1da25ff80e8ab396c636df6575353bff0b /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent9ccbed5a12fd85eae9ca5571636d21ee34ab4d22 (diff)
downloadbcm5719-llvm-dd925ad21830ee59c8a5fccde5e07e7156e91588.tar.gz
bcm5719-llvm-dd925ad21830ee59c8a5fccde5e07e7156e91588.zip
LSR: Minor cleanup after Daniel's patch.
Combine the Inserted an Done sets into a Visited set. llvm-svn: 220623
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index e1d18e8f99b..9ef9b05639a 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -3116,14 +3116,13 @@ bool LSRInstance::InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F) {
void
LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
SmallVector<const SCEV *, 8> Worklist(RegUses.begin(), RegUses.end());
- SmallPtrSet<const SCEV *, 8> Inserted;
- SmallPtrSet<const SCEV *, 32> Done;
+ SmallPtrSet<const SCEV *, 32> 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<SCEVNAryExpr>(S))
@@ -3134,7 +3133,6 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
Worklist.push_back(D->getLHS());
Worklist.push_back(D->getRHS());
} else if (const SCEVUnknown *US = dyn_cast<SCEVUnknown>(S)) {
- if (!Inserted.insert(US)) continue;
const Value *V = US->getValue();
if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
// Look for instructions defined outside the loop.
OpenPOWER on IntegriCloud