diff options
author | Nikita Popov <npopov@redhat.com> | 2025-08-04 10:02:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-04 10:02:04 +0200 |
commit | 86727fe9a13daf313429c04fe602f45dbf35036c (patch) | |
tree | 18b890674ae3ce47cb5169638e0ca250a311b53e /llvm/lib/Transforms/Utils/Local.cpp | |
parent | d95dadff8f094e793b79eec57737ec397fad7724 (diff) | |
download | llvm-86727fe9a13daf313429c04fe602f45dbf35036c.zip llvm-86727fe9a13daf313429c04fe602f45dbf35036c.tar.gz llvm-86727fe9a13daf313429c04fe602f45dbf35036c.tar.bz2 |
[IR] Allow poison argument to lifetime markers (#151148)
This slightly relaxes the invariant established in #149310, by also
allowing the lifetime argument to be poison. This is to support the
typical pattern of RAUWing with poison when removing an instruction.
It's worth noting that this does not require any conservative
assumptions, lifetimes with poison arguments can simply be skipped.
Fixes https://github.com/llvm/llvm-project/issues/151119.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index babd7f6..3852f1a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -482,6 +482,9 @@ bool llvm::wouldInstructionBeTriviallyDead(const Instruction *I, if (II->isLifetimeStartOrEnd()) { auto *Arg = II->getArgOperand(1); + if (isa<PoisonValue>(Arg)) + return true; + // If the only uses of the alloca are lifetime intrinsics, then the // intrinsics are dead. return llvm::all_of(Arg->uses(), [](Use &Use) { |