[llvm] [LoopPeel] LCSSA form is destroyed by LoopPeel, preserve it (PR #78696)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 20 05:00:17 PST 2024
================
@@ -644,6 +644,13 @@ bool SimplifyIndvar::replaceIVUserWithLoopInvariant(Instruction *I) {
auto *Invariant = Rewriter.expandCodeFor(S, I->getType(), IP);
+ if (!LI->replacementPreservesLCSSAForm(I, Invariant)) {
+ LLVM_DEBUG(dbgs() << "INDVARS: Can not replace IV user: " << *I
+ << " with loop invariant: " << *S
+ << " as it breaks LCSSA form " << '\n');
+ return false;
+ }
----------------
nikic wrote:
SCEVExpander is also supposed to preserve LCSSA form (if PreserveLCSSA is enabled, which it is by default), so I think the actual fix needs to be in SCEVExpander. It's not possible to abort a transform after using SCEVExpander.
https://github.com/llvm/llvm-project/pull/78696
More information about the llvm-commits
mailing list