[PATCH] D104007: [BasicAA] Properly mark that coroutine suspension may modify parameters
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 19:48:22 PDT 2021
lxfind created this revision.
lxfind added reviewers: nikic, asbirlea, ChuanqiXu, rjmccall.
Herald added subscribers: hoy, modimo, wenlei, hiraditya.
lxfind requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch is to address https://bugs.llvm.org/show_bug.cgi?id=48857.
When there is a memcpy from a byvalue argument (which is marked as readonly) to a stack alloca, and then latter another memcpy from the stack alloca to another stack alloca, MemCpyOpt will optimize the two memcpys
and turn them into one memcpy. Unfortunately this is incorrect in a coroutine where during a coroutine suspension, the byvalue argument may die outside of the coroutine.
Ultimately, this could be expressed as that a coroutine suspension could potentially modify (and reference) the arguments, so even though the argument is marked as readonly, we still need to assume that they may change during the call to coro_suspend intrinsic.
This change properly fixed the bug around memcpy optimization.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104007
Files:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Transforms/MemCpyOpt/coroutine-params.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104007.351048.patch
Type: text/x-patch
Size: 8857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210610/f5e1108f/attachment.bin>
More information about the llvm-commits
mailing list