[PATCH] D99179: [RFC] [Coroutines] Enable printing coroutine frame in debugger if program is compiled with -g

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 18:55:20 PDT 2021


ChuanqiXu added inline comments.


================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:894
+                                FrameDataInfo &FrameData) {
+  if (!llvm::count_if(F.getParent()->debug_compile_units(), [](auto *Iter) {
+        return dwarf::isCPlusPlus(
----------------
dblaikie wrote:
> ChuanqiXu wrote:
> > dblaikie wrote:
> > > lxfind wrote:
> > > > Does this mean that if there is any C++ files, we don't build debug info?
> > > aside, I guess this should probably be using `llvm::none_of` - it'll shortcircuit (won't keep testing every CU if it finds one that is C++) and is more clear about the semantic goal of the test compared to the !count current phrasing.
> > > 
> > > But also: Why is the code searching all the CUs? Wouldn't it be better to test the CU of the Function being passed in only? Then this code won't behave differently under LTO?
> > @dblaikie Thanks for reminding! Previously I am not so familiar with the API system for debug. It makes more sense to test the CU for the Function only.
> > 
> > This wouldn't behave differently under LTO since the related intrinsic would be lowered after we construct the coroutine frame.
> > @dblaikie Thanks for reminding! Previously I am not so familiar with the API system for debug. It makes more sense to test the CU for the Function only.
> > 
> > This wouldn't behave differently under LTO since the related intrinsic would be lowered after we construct the coroutine frame.
> 
> I don't understand this, sorry. Do you mean that this lowering pass always happens before LTO? So the old code was only ever really (in the common use case) going to see one CU in the CU list anyway?
Yes, this lowering pass always happens before LTO. 

Internally, in CoroSplit Pass, who would call the codes in CoroFrame, it would collect if the current function has attribute `CORO_PRESPLIT_ATTR` to decide whether to run it actually. After CoroSplit is done actually, the attribute  `CORO_PRESPLIT_ATTR ` would be removed, so a function shouldn't run CoroSplit pass twice actually.


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

https://reviews.llvm.org/D99179



More information about the llvm-commits mailing list