Skip to content

Commit

Permalink
[LCSSA] Don't invalidate entire loop in SCEV
Browse files Browse the repository at this point in the history
We already invalidate each individual instruction for which LCSSA
is formed in formLCSSAForInstructions(), so I don't see a reason
why we would need to invalidate the entire loop on top of that.

I believe we also no longer need the instruction-level invalidation
now that SCEV looks through LCSSA phis, but I'll leave that for a
separate patch, as it's less obvious.

Differential Revision: https://reviews.llvm.org/D149331
  • Loading branch information
nikic committed Apr 28, 2023
1 parent 575fdea commit 0aed0db
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions llvm/lib/Transforms/Utils/LCSSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,6 @@ bool llvm::formLCSSA(Loop &L, const DominatorTree &DT, const LoopInfo *LI,
IRBuilder<> Builder(L.getHeader()->getContext());
Changed = formLCSSAForInstructions(Worklist, DT, *LI, SE, Builder);

// If we modified the code, remove any caches about the loop from SCEV to
// avoid dangling entries.
// FIXME: This is a big hammer, can we clear the cache more selectively?
if (SE && Changed)
SE->forgetLoop(&L);

assert(L.isLCSSAForm(DT));

return Changed;
Expand Down

0 comments on commit 0aed0db

Please sign in to comment.