[PATCH] D149331: [LCSSA] Don't invalidate entire loop in SCEV

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 04:02:03 PDT 2023


nikic created this revision.
nikic added reviewers: fhahn, efriedma.
Herald added subscribers: hoy, StephenFan, javed.absar, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


https://reviews.llvm.org/D149331

Files:
  llvm/lib/Transforms/Utils/LCSSA.cpp


Index: llvm/lib/Transforms/Utils/LCSSA.cpp
===================================================================
--- llvm/lib/Transforms/Utils/LCSSA.cpp
+++ llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -395,12 +395,6 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149331.517509.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230427/327aea97/attachment.bin>


More information about the llvm-commits mailing list