[llvm-dev] [RFC] Generate Debug Information for Labels in Function

Hsiangkai Wang via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 1 09:12:09 PDT 2018


Hi all,

I am sorry that I didn’t carefully think about how to handle labels in
inlined function.

Today, I did some simple experiments and found that some basic block
may be removed in CFGSimplifyPass and the attached metadata will be
eliminated. So, if the optimization is turned on, label metadata will
disappear. However, intrinsic will keep existing in the function if we
handle it correctly. So, if we take care about optimization and
inlining, to keep label metadata through intrinsic could be right for
free.

I learned a lot from discussions. Thanks for your comments and
suggestions. If there is no other concern, I will keep my original
implementation and send patches to Phabricator again. Sorry have
bothered you.

Any comments?

On Sat, Mar 31, 2018 at 5:38 AM, Reid Kleckner <rnk at google.com> wrote:
> On Fri, Mar 30, 2018 at 9:39 AM Adrian Prantl <aprantl at apple.com> wrote:
>>
>> I'm really sorry for not realizing this yesterday, but the problems
>> pertaining to inlining made me realize that your original design with the
>> dbg.label intrinsic might actually be a better approach especially when
>> considering optimized code. We will get inlining support for free because it
>> is just another instruction and it can deal with more than one label at the
>> same address. It looks a bit more complicated in unoptimized code, but that
>> seems like a small price to pay.
>>
>> We just need to make sure that the backend doesn't get confused when loop
>> unrolling duplicates a dbg.label but that should be doable.
>
>
> +10, it should be an intrinsic.


More information about the llvm-dev mailing list