Skip to content

Commit

Permalink
[LCSSA] Don't invalidate SCEV
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nikic committed May 2, 2023
1 parent a257616 commit 5cbb9f7
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions llvm/lib/Transforms/Utils/LCSSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5cbb9f7

Please sign in to comment.