[PATCH] D89768: [Coroutine] Properly determine whether an alloca should live on the frame
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 27 22:43:07 PDT 2020
lxfind added inline comments.
================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:921
+ for (auto *BB2 : UserBBs)
+ if (Checker.hasPathCrossingSuspendPoint(BB1, BB2))
+ return true;
----------------
junparser wrote:
> Still need call Checker.hasPathCrossingSuspendPoint(AllocaDef, Pointeruser)
We cannot do that because the whole purpose of this rewrite is to check if uses of the alloca belong to different suspend regions, which causes the spill.
I thought about this a bit more, and my conclusion is that although the API is not intended to be used this way, it actually works here.
The goal for this loop is to check whether an alloca needs to live across a suspension. If an alloca needs to live across a suspension, it means there exists a coro.suspend such that a user BB happens before it and a user BB happens after it, and these two BBs must dominate each other through coro.susend. Hence one of the user BB pairs must return true on the hasPathCrossingSuspendPoint check. On the other hand, for BBs that don't even dominate each other, hasPathCrossingSuspendPoint will return false anyway and won't affect the algorithm.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89768/new/
https://reviews.llvm.org/D89768
More information about the llvm-commits
mailing list