[llvm] [LangRef] Disallow accessing byval arguments from tail-called functions (PR #110093)

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 10:06:56 PDT 2024


================
@@ -12658,10 +12658,55 @@ 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 from the caller.
-   The ``tail`` marker additionally implies that the callee does not access
-   varargs from the caller. Calls marked ``musttail`` must obey the following
-   additional  rules:
+   Both markers imply that the callee does not access allocas or varargs from
+   the caller. They also imply that the callee does not access the memory
+   pointed to by a byval argument to the caller, unless that pointer is passed
+   to the callee as a byval argument. For example:
+
+.. code-block:: llvm
+
+      declare void @take_byval(ptr byval(i64))
+      declare void @take_ptr(ptr)
+
+      ; Invalid, %local may be de-allocated before call to @take_ptr.
----------------
ostannard wrote:

Done

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


More information about the llvm-commits mailing list