[PATCH] D37093: [coroutines] Promote cleanup.dest.slot-like allocas to registers to avoid storing them in the coroutine frame

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 11:58:37 PDT 2017


rjmccall added a comment.

In https://reviews.llvm.org/D37093#910951, @rjmccall wrote:

> In https://reviews.llvm.org/D37093#910909, @GorNishanov wrote:
>
> > @rjmccall suggested to do the cleanup dest slot elimination wholesale for all functions in clang. (Not specific for coroutines).
> >  That is a sweeping change :-), so, I don't mind still having this here to unblock Facebook and when the clang change lands, remove this part from llvm.
>
>
> Well, I said that I wouldn't be opposed to cleaning up the cleanup dest slot unconditionally.  I expressed no opinion about whether that was a reasonable way to fix this problem in your representation.  (This doesn't affect my lowering as coro.end is always a terminator.)


I think you probably do need to solve this problem more generally, as it sounds like any use of an alloca in the post-coro.end section of the function will lead to miscompiles.  It sounds like you have some control of the post-coro.end generated code, so maybe allocas don't normally affect you there — but from the fact that you have uses of the cleanup dest, I assume you're branching through cleanups, which means you have calls, which means you can have arbitrary code there if the callee is marked always_inline.


https://reviews.llvm.org/D37093





More information about the llvm-commits mailing list