[llvm] [DirectX] Remove lifetime intrinsics and run Dead Store Elimination (PR #152636)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 12:56:19 PDT 2025
================
@@ -78,6 +82,17 @@ static bool forwardHandleAccesses(Function &F, DominatorTree &DT) {
case Intrinsic::dx_resource_handlefromimplicitbinding:
processHandle(II, HandleMap);
break;
+ // Note: Lifetime intrinsics do not show up as users of an Alloca.
+ // As a result we walk the whole function to find the lifetimes and
+ // store them so that we may delete the alloca matches
+ case Intrinsic::lifetime_start:
+ case Intrinsic::lifetime_end:
+ if (II->arg_size() >= 1) {
+ Value *Ptr = II->getArgOperand(0);
+ if (auto *Alloca = dyn_cast<AllocaInst>(Ptr->stripPointerCasts()))
----------------
Icohedron wrote:
The `Ptr->stripPointerCasts()` is a no-op here. The pointer operand of a Lifetime intrinsic must either be an AllocaInst or a PoisonValue; it can't be anything else.
https://github.com/llvm/llvm-project/pull/152636
More information about the llvm-commits
mailing list