[PATCH] D149435: [LCSSA] Don't invalidate SCEV

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 04:01:42 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.

LCSSA currently invalidates SCEV for all instructions for which LCSSA phi nodes are created. This used to be necessary, because SCEV has historically tried to maintain LCSSA form as well. As such, some SCEV uses of the value would have to become uses of the phi node instead.

However, nowadays SCEV itself no longer maintains LCSSA form. The SCEV of on LCSSA phi node will be the same as the SCEV of its argument. LCSSA is instead maintained in the SCEVExpander.

As such, I believe it is no longer necessary to perform any SCEV invalidation during LCSSA construction.

After this patch the ScalarEvolution argument to the LCSSA utilities is no longer necessary -- I'll remove it in a followup NFC patch to keep this patch more concise.


https://reviews.llvm.org/D149435

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
@@ -150,11 +150,6 @@
     SSAUpdater SSAUpdate(&InsertedPHIs);
     SSAUpdate.Initialize(I->getType(), I->getName());
 
-    // Force re-computation of I, as some users now need to use the new PHI
-    // node.
-    if (SE)
-      SE->forgetValue(I);
-
     // Insert the LCSSA phi's into all of the exit blocks dominated by the
     // value, and add them to the Phi's map.
     for (BasicBlock *ExitBB : ExitBlocks) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149435.517861.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230428/f9aee7a4/attachment.bin>


More information about the llvm-commits mailing list