[PATCH] D104007: [BasicAA] Properly mark that coroutine suspension may modify parameters
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 14 16:55:44 PDT 2021
lxfind added a comment.
In D104007#2817612 <https://reviews.llvm.org/D104007#2817612>, @efriedma wrote:
>> However latter optimization passes could very well optimize out that copy because the copy would appear to be useless without considering what coro_suspend does, which is why we are changing BasicAA to prevent such elimination.
>
> If an argument is just a pointer without any argument attributes, BasicAA will assume coro_suspend frees the underlying allocations. Not because it has any particular knowledge of how coro_suspend works, but because that's the default assumption for any function call with unknown semantics.
>
> BasicAA treats arguments marked byval differently because it understands the semantics of byval: it uses escape analysis to prove an arbitrary function call can't modify the contents.
>
> --------
>
> I guess in some sense, it's possible to specify a world where coro_suspend frees byval allocations. But such a world doesn't really make sense. And we'd need to audit every pass that knows anything about byval semantics, so I really don't want to go down that path.
Thank you so much! I understand it now.
Let me also play with inalloca attribute just to double check.
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