[llvm] bdd638a - [Local] Remove handling for lifetime intrinsic on non-alloca (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 05:21:33 PDT 2025
Author: Nikita Popov
Date: 2025-07-23T14:21:22+02:00
New Revision: bdd638a89763046d9cbd8493c8801ef0898c8555
URL: https://github.com/llvm/llvm-project/commit/bdd638a89763046d9cbd8493c8801ef0898c8555
DIFF: https://github.com/llvm/llvm-project/commit/bdd638a89763046d9cbd8493c8801ef0898c8555.diff
LOG: [Local] Remove handling for lifetime intrinsic on non-alloca (NFC)
After #149310 this is guaranteed to be an alloca.
Added:
Modified:
llvm/lib/Transforms/Utils/Local.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index f89d36f98675d..babd7f6b3a058 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -482,16 +482,11 @@ bool llvm::wouldInstructionBeTriviallyDead(const Instruction *I,
if (II->isLifetimeStartOrEnd()) {
auto *Arg = II->getArgOperand(1);
- // Lifetime intrinsics are dead when their right-hand is undef.
- if (isa<UndefValue>(Arg))
- return true;
- // If the right-hand is an alloc, global, or argument and the only uses
- // are lifetime intrinsics then the intrinsics are dead.
- if (isa<AllocaInst>(Arg) || isa<GlobalValue>(Arg) || isa<Argument>(Arg))
- return llvm::all_of(Arg->uses(), [](Use &Use) {
- return isa<LifetimeIntrinsic>(Use.getUser());
- });
- return false;
+ // If the only uses of the alloca are lifetime intrinsics, then the
+ // intrinsics are dead.
+ return llvm::all_of(Arg->uses(), [](Use &Use) {
+ return isa<LifetimeIntrinsic>(Use.getUser());
+ });
}
// Assumptions are dead if their condition is trivially true.
More information about the llvm-commits
mailing list