[llvm] 5cbb9f7 - [LCSSA] Don't invalidate SCEV

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 01:02:00 PDT 2023


Author: Nikita Popov
Date: 2023-05-02T10:01:50+02:00
New Revision: 5cbb9f7a58d98ba432c6ddeefa581f6fc521315c

URL: https://github.com/llvm/llvm-project/commit/5cbb9f7a58d98ba432c6ddeefa581f6fc521315c
DIFF: https://github.com/llvm/llvm-project/commit/5cbb9f7a58d98ba432c6ddeefa581f6fc521315c.diff

LOG: [LCSSA] Don't invalidate SCEV

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.

Differential Revision: https://reviews.llvm.org/D149435

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp
index 4b006f5288dcf..7affa83db5999 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -150,11 +150,6 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
     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) {


        


More information about the llvm-commits mailing list