[PATCH] D94388: [Coroutine][DebugInfo] Enhance the ability of coroutine to debug parameters under O2

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 17:58:03 PST 2021


junparser added a comment.

In D94388#2570198 <https://reviews.llvm.org/D94388#2570198>, @junparser wrote:

> In D94388#2535388 <https://reviews.llvm.org/D94388#2535388>, @aprantl wrote:
>
>> In D94388#2500214 <https://reviews.llvm.org/D94388#2500214>, @dongAxis1944 wrote:
>>
>>> I think if we use fake variable to solve this, it might cause the patch https://reviews.llvm.org/D93497 fail to print variable under O0 level
>>>
>>> In D94388#2499901 <https://reviews.llvm.org/D94388#2499901>, @junparser wrote:
>>>
>>>> In D94388#2499897 <https://reviews.llvm.org/D94388#2499897>, @junparser wrote:
>>>>
>>>>> In D94388#2494294 <https://reviews.llvm.org/D94388#2494294>, @aprantl wrote:
>>>>>
>>>>>> Do we understand *why* the frontend is emitting the variables twice? If that just a bug in the clang frontend (which would be my first guess) then we should aim at fixing the frontend instead. If the frontend is trying to do something different, I would love to understand what that is.
>>>>>
>>>>> Hi @aprantl, 
>>>>> According to the standard, coroutine needs to copy parameters (calling constructor) passed to the coroutine function by the original caller into the coroutine frame. So in frontend, we fake local variables for this behavior, that why we see two variables in debuginfo.
>>>>
>>>> So, this is not the bug, shold we avoid this by using anonymous fake variables?
>>
>> If I understand correctly, what ends up as the "real" function parameters in DWARF are the function arguments passed into the coro entry point, and the artificial variables are what is stored in the CoroFrame, and those are the only ones visible in the .resume funclets. Is this correct? If yes, we probably do want both to be visible, because they end up in different funclets.
>
> Sorry for the late reply. With O1 <https://reviews.llvm.org/owners/package/1/> or above, yes, we can only see artificial variables in .resume function. IIUC, we want see "real" function parameters in ramp function and artificial variables in resume function and they do have different scope, then the debugger may print them correctly. am i right?

@aprantl any update on this?


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

https://reviews.llvm.org/D94388



More information about the llvm-commits mailing list