[llvm] [MemoryLocation] Compute lifetime size from alloca size (PR #151982)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 11:01:15 PDT 2025


================
@@ -190,7 +190,21 @@ MemoryLocation MemoryLocation::getForArgument(const CallBase *Call,
       return MemoryLocation::getAfter(Arg, AATags);
 
     case Intrinsic::lifetime_start:
-    case Intrinsic::lifetime_end:
+    case Intrinsic::lifetime_end: {
+      assert(ArgIdx == 1 && "Invalid argument index");
+      auto *AI = dyn_cast<AllocaInst>(Arg);
+      if (!AI)
+        // lifetime of poison value.
+        return MemoryLocation::getBeforeOrAfter(Arg);
----------------
fhahn wrote:

Sounds good

https://github.com/llvm/llvm-project/pull/151982


More information about the llvm-commits mailing list