[llvm] [IR] Add `dead_on_return` attribute (PR #143271)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 09:58:58 PDT 2025


================
@@ -855,3 +855,11 @@ bb:
   store ptr null, ptr null, align 8
   ret void
 }
+
+define void @test50(ptr dead_on_return %p) {
+; CHECK-LABEL: @test50(
+; CHECK-NEXT:    ret void
+;
+  store i8 0, ptr %p
+  ret void
+}
----------------
antoniofrighetto wrote:

Test added. The store gets deleted as we are always adding the pointer argument to the InvisibleToCallerAfterRet map (thus re-insertion won't take place in `isInvisibleToCallerAfterRet`). Thinking more on this, I believe this should be the behaviour we'd want here. Updated the LangRef again, hope the wording is coherent.

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


More information about the llvm-commits mailing list