Skip to content

Commit bdd638a

Browse files
committed
[Local] Remove handling for lifetime intrinsic on non-alloca (NFC)
After #149310 this is guaranteed to be an alloca.
1 parent 114d74e commit bdd638a

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -482,16 +482,11 @@ bool llvm::wouldInstructionBeTriviallyDead(const Instruction *I,
482482

483483
if (II->isLifetimeStartOrEnd()) {
484484
auto *Arg = II->getArgOperand(1);
485-
// Lifetime intrinsics are dead when their right-hand is undef.
486-
if (isa<UndefValue>(Arg))
487-
return true;
488-
// If the right-hand is an alloc, global, or argument and the only uses
489-
// are lifetime intrinsics then the intrinsics are dead.
490-
if (isa<AllocaInst>(Arg) || isa<GlobalValue>(Arg) || isa<Argument>(Arg))
491-
return llvm::all_of(Arg->uses(), [](Use &Use) {
492-
return isa<LifetimeIntrinsic>(Use.getUser());
493-
});
494-
return false;
485+
// If the only uses of the alloca are lifetime intrinsics, then the
486+
// intrinsics are dead.
487+
return llvm::all_of(Arg->uses(), [](Use &Use) {
488+
return isa<LifetimeIntrinsic>(Use.getUser());
489+
});
495490
}
496491

497492
// Assumptions are dead if their condition is trivially true.

0 commit comments

Comments
 (0)