[llvm] [TailCallElim] Do not mark a call tail when it is handed the frame (PR #218797)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 00:46:32 PDT 2026


================
@@ -13725,10 +13725,16 @@ This instruction requires several arguments:
       the return value of the callee is returned to the caller's caller, even
       if a void return type is in use.
 
-   Both markers imply that the callee does not access allocas, va_args, or
-   byval arguments from the caller. As an exception to that, an alloca or byval
-   argument may be passed to the callee as a byval argument, which can be
-   dereferenced inside the callee. For example:
+   Both markers imply that the callee does not access allocas, va_args, byval
+   arguments, or any other part of the caller's stack frame. The frame is torn
+   down before the callee runs, so this covers addresses of the frame itself:
+   the callee may not access the result of `llvm.frameaddress` with a level of
+   zero, `llvm.addressofreturnaddress`, `llvm.eh.dwarf.cfa`,
+   `llvm.localaddress`, `llvm.sponentry`, `llvm.stackaddress`,
+   `llvm.stacksave`, or `llvm.swift.async.context.addr` evaluated in the
----------------
antoniofrighetto wrote:

Would it make sense to state the rule in terms of the concept, i.e., "any value derived from the caller's stack frame", and possibly mention a few of the current intrinsics as illustrative examples? (That way the specification shouldn't need an update when a new intrinsic that yields a pointer into the caller's frame is added).

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


More information about the llvm-commits mailing list