[llvm] [LCSSA] Avoid rewriting lifetime markers through PHIs (PR #210811)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 20 20:35:02 PDT 2026
================
@@ -106,10 +106,22 @@ formLCSSAForInstructionsImpl(SmallVectorImpl<Instruction *> &Worklist,
if (ExitBlocks.empty())
continue;
+ SmallVector<Instruction *, 4> LifetimeMarkers;
+ bool DropLifetimeMarkers = false;
for (Use &U : make_early_inc_range(I->uses())) {
Instruction *User = cast<Instruction>(U.getUser());
BasicBlock *UserBB = User->getParent();
+ // Lifetime markers must refer directly to an alloca. Rewriting their
+ // operands through LCSSA PHIs would produce invalid IR, so conservatively
+ // drop all lifetime markers when one crosses the loop boundary.
+ if (User->isLifetimeStartOrEnd()) {
+ LifetimeMarkers.push_back(User);
----------------
boomanaiden154 wrote:
Why do we need to wait until we're outside of the loop to drop the user? We're already using `make_early_inc_range`.
https://github.com/llvm/llvm-project/pull/210811
More information about the llvm-commits
mailing list