[PATCH] D116327: [Coroutines] Enhance symmetric transfer for constant CmpInst

Erich Keane via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 10:25:08 PST 2022


erichkeane added a comment.

In D116327#3247285 <https://reviews.llvm.org/D116327#3247285>, @ChuanqiXu wrote:

> In D116327#3243349 <https://reviews.llvm.org/D116327#3243349>, @sidorovd wrote:
>
>> @ChuanqiXu hi, with this patch the generated LLVM IR snippet is looking like:
>>
>>   %_Z5task0v.Frame = type { void (%_Z5task0v.Frame*)*, void (%_Z5task0v.Frame*)*, %struct.TaskPromise, i1 }
>>
>> (see https://godbolt.org/z/b3s9a4xnW - it's the same example from the patch's headed, but with -S -emit-llvm).
>>
>> In the following patch you add a regression test clang/test/CodeGenCoroutines/coro-elide.cpp , which checks an opposite, which is a bit confusing
>>
>>   // CHECK: %_Z5task1v.Frame = type {{.*}}%_Z5task0v.Frame
>>
>> Could you please tell if it's a typo or it was done intentional? If intentional, I keen to know, where could I learn more about the coroutine frame jump, thanks :)
>
> Yeah, it is intentional. I added two regression tests in the following commit. But only one is related to this revision, while the other one you mentioned is related to another optimization for coroutine. The optimization is called Coroutine Elision. You could find the original design in: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0981r0.html. For the more detailed implementation, you might need to take a look at CoroElide pass. For the coroutine intrinsic, it is good to visit https://llvm.org/docs/Coroutines.html. It is not completed now. For example, I found that it lacks a ABI document just now...

So the problem I'm seeing in our downstream (which might be behind) is that the _Z5task1v.Frame is:

`%_Z5task1v.Frame = type { void (%_Z5task1v.Frame*)*, void (%_Z5task1v.Frame*)*, %"struct.Task::promise_type", i2 }`

Note that this does NOT match the 'CHECK' line.

HOWEVER, in upstream, I see:
`%_Z5task1v.Frame = type { void (%_Z5task1v.Frame*)*, void (%_Z5task1v.Frame*)*, %"struct.Task::promise_type", %_Z5task0v.Frame, i2 }`

Note the `%_Z5task0v.Frame` before the 'i2'.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116327/new/

https://reviews.llvm.org/D116327



More information about the llvm-commits mailing list