Skip to content

Commit 916ba45

Browse files
committed
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
1 parent abb11dd commit 916ba45

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,14 +3116,13 @@ bool LSRInstance::InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F) {
31163116
void
31173117
LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
31183118
SmallVector<const SCEV *, 8> Worklist(RegUses.begin(), RegUses.end());
3119-
SmallPtrSet<const SCEV *, 8> Inserted;
3120-
SmallPtrSet<const SCEV *, 32> Done;
3119+
SmallPtrSet<const SCEV *, 32> Visited;
31213120

31223121
while (!Worklist.empty()) {
31233122
const SCEV *S = Worklist.pop_back_val();
31243123

31253124
// Don't process the same SCEV twice
3126-
if (!Done.insert(S))
3125+
if (!Visited.insert(S))
31273126
continue;
31283127

31293128
if (const SCEVNAryExpr *N = dyn_cast<SCEVNAryExpr>(S))
@@ -3134,7 +3133,6 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
31343133
Worklist.push_back(D->getLHS());
31353134
Worklist.push_back(D->getRHS());
31363135
} else if (const SCEVUnknown *US = dyn_cast<SCEVUnknown>(S)) {
3137-
if (!Inserted.insert(US)) continue;
31383136
const Value *V = US->getValue();
31393137
if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
31403138
// Look for instructions defined outside the loop.

0 commit comments

Comments
 (0)