[PATCH] D104007: [BasicAA] Properly mark that coroutine suspension may modify parameters
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 13 08:58:08 PDT 2021
lxfind added a comment.
In D104007#2814244 <https://reviews.llvm.org/D104007#2814244>, @efriedma wrote:
> In D104007#2813714 <https://reviews.llvm.org/D104007#2813714>, @efriedma wrote:
>
>>> Do you know if there is a stable contract in IR to tell whether an argument is in fact a callee-owned memory?
>>
>> Argument::hasPassPointeeByValueCopyAttr()
>
> Sorry, that's not right. The question you want to answer here is whether the pointer in the caller points to different memory from the pointer in the callee. The only attribute that causes that is byval, and it's very unlikely we'll ever add any others.
>
> inalloca/preallocated memory is part of the callee stack frame, at a low level. But it's actually allocated in the caller, so from an alias-analysis perspective, it doesn't count as a local allocation like byval would.
It seems that there is no stable contract to tell whether an argument is byval, and it depends on the target.
For example: https://godbolt.org/z/YcrYPbMdc
So we won't be able to fix this just in CoroSplit pass. Either we change the front-end to force all byval arguments to have byval attribute (not sure if that's possible), or we may have to conservatively go with this patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104007/new/
https://reviews.llvm.org/D104007
More information about the llvm-commits
mailing list