[PATCH] D135783: [FunctionAttrs] Account for memory effects of inalloca/preallocated
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 12 11:44:56 PDT 2022
nikic added a comment.
In D135783#3853152 <https://reviews.llvm.org/D135783#3853152>, @rnk wrote:
> Inalloca (& preallcoated) effectively allows the caller to take the address of the argument stack memory used for the call. The call effectively **deallocates** the argument memory, since it can immediately be reused by the next call, so it should be modeled like `free`.
I see, thanks! It looks like this is also mentioned in https://llvm.org/docs/InAlloca.html#callee-cleanup-calling-conventions:
> Another wrinkle is the existence of callee-cleanup conventions. On Windows, all methods and many other functions adjust the stack to clear the memory used to pass their arguments. In some sense, this means that the allocas are automatically cleared by the call. However, LLVM instead models this as a write of undef to all of the inalloca values passed to the call instead of a stack adjustment. Frontends should still restore the stack pointer to avoid a stack leak.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135783/new/
https://reviews.llvm.org/D135783
More information about the llvm-commits
mailing list