[llvm] 3c9cf02 - Revert "[LCSSA] Don't invalidate SCEV"
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 5 08:28:41 PDT 2023
Author: Nikita Popov
Date: 2023-06-05T17:28:32+02:00
New Revision: 3c9cf023db32ba2cfa1e052ddc58f57dd080995c
URL: https://github.com/llvm/llvm-project/commit/3c9cf023db32ba2cfa1e052ddc58f57dd080995c
DIFF: https://github.com/llvm/llvm-project/commit/3c9cf023db32ba2cfa1e052ddc58f57dd080995c.diff
LOG: Revert "[LCSSA] Don't invalidate SCEV"
This reverts commit 5cbb9f7a58d98ba432c6ddeefa581f6fc521315c.
Causes verifier error reported at
https://reviews.llvm.org/D149331#4387931.
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 5f1c98cd703a7..183e0a4422d15 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -76,7 +76,7 @@ static bool isExitBlock(BasicBlock *BB,
/// rewrite the uses.
bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
const DominatorTree &DT, const LoopInfo &LI,
- ScalarEvolution *Se,
+ ScalarEvolution *SE,
SmallVectorImpl<PHINode *> *PHIsToRemove,
SmallVectorImpl<PHINode *> *InsertedPHIs) {
SmallVector<Use *, 16> UsesToRewrite;
@@ -148,6 +148,11 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
SSAUpdater SSAUpdate(&LocalInsertedPHIs);
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