[llvm] [CoroSplit] Always erase lifetime intrinsics for spilled allocas (PR #142551)
Chuanqi Xu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 00:56:37 PDT 2025
================
@@ -1212,14 +1212,29 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
Builder.SetInsertPoint(Shape.AllocaSpillBlock,
Shape.AllocaSpillBlock->begin());
SmallVector<Instruction *, 4> UsersToUpdate;
+ SmallVector<Instruction *, 4> Lifetimes;
for (const auto &A : FrameData.Allocas) {
AllocaInst *Alloca = A.Alloca;
UsersToUpdate.clear();
+ Lifetimes.clear();
for (User *U : Alloca->users()) {
auto *I = cast<Instruction>(U);
- if (DT.dominates(Shape.CoroBegin, I))
+ if (I->isLifetimeStartOrEnd())
+ Lifetimes.push_back(I);
+ else if (DT.dominates(Shape.CoroBegin, I))
UsersToUpdate.push_back(I);
}
+
+ // If it is hard to analyze, we will give up and put allocas to frame,
+ // even if they never cross suspend points.Lifetime intrinsics referring
+ // to alloca may fail guard storing to frame.
+ //
+ // It is meaningless to retain the lifetime intrinsics refer for the
+ // member of coroutine frames and the meaningless lifetime intrinsics
+ // are possible to block further optimizations.
----------------
ChuanqiXu9 wrote:
```suggestion
// It is meaningless to retain the lifetime intrinsics refer for the
// member of coroutine frames and the meaningless lifetime intrinsics
// are possible to block further optimizations.
```
https://github.com/llvm/llvm-project/pull/142551
More information about the llvm-commits
mailing list