[llvm-dev] [RFC] A value-tracking LiveDebugValues implementation
Zhang, Xiang1 via llvm-dev
llvm-dev at lists.llvm.org
Wed Nov 11 03:31:04 PST 2020
Got it! Thank you very much!! : )
-----Original Message-----
From: Jeremy Morse <jeremy.morse.llvm at gmail.com>
Sent: Wednesday, November 11, 2020 7:13 PM
To: Zhang, Xiang1 <xiang1.zhang at intel.com>
Cc: Adrian Prantl <aprantl at apple.com>; Paul Robinson <paul.robinson at sony.com>; Eric Christopher <echristo at gmail.com>; Jonas Devlieghere <jdevlieghere at apple.com>; David Blaikie <dblaikie at gmail.com>; Vedant Kumar <vedant_kumar at apple.com>; Reid Kleckner <rnk at google.com>; orlando.hyams at sony.com; Stephen.Tozer at sony.com; Djordje Todorovic <djordje.todorovic at rt-rk.com>; Luo, Yuanke <yuanke.luo at intel.com>; Zhang, Annita <annita.zhang at intel.com>; Wang, Pengfei <pengfei.wang at intel.com>; llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] [RFC] A value-tracking LiveDebugValues implementation
Hi Xiang,
On Wed, Nov 11, 2020 at 1:59 AM Zhang, Xiang1 <xiang1.zhang at intel.com> wrote:
> Jeremy wrote:
> > ... The value %0 is live up to and including the ADD64ri but not past it, meaning LLVM today will drop the DBG_VALUE ...
>
> Just a little puzzle about the " drop the DBG_VALUE ", maybe I didn't get your key point,
> So I write a phi case, it like
> ___________________________________________________
> vaarg.end: ; preds = %vaarg.in_mem, %vaarg.in_reg
> %5 = phi i32 [ %4, %vaarg.in_reg ], [ %l5, %vaarg.in_mem ], !dbg !50
> %6 = add nsw i32 %gp_offset, %vaarg.l, !dbg !41
> call void @llvm.dbg.value(metadata i32 %5, metadata !28, metadata !DIExpression()), !dbg !50
> ret i32 %6, !dbg !52
> ____________________________________________________
> After phi-elimination, it is
>
> bb.3.vaarg.end:
> ; predecessors: %bb.2, %bb.1
>
> %5:gr32 = COPY killed %18:gr32, debug-location !50; phi.ll:21:1 // %18 was def in all predecessors //phi --> COPY killed %18
> %17:gr32 = ADD32rr killed %8:gr32(tied-def 0), killed %5:gr32, implicit-def dead $eflags, debug-location !41; phi.ll:12:1 // kill %5
> DBG_VALUE %5:gr32, $noreg, !"15", !DIExpression(), debug-location !50; phi.ll:21:1 line no:21
> $eax = COPY killed %17:gr32, debug-location !51; phi.ll:23:1
> RETQ implicit killed $eax, debug-location !51; phi.ll:23:1
> ____________________________________________________
> Go on, After Simple Register Coalescing
>
> 336B bb.3.vaarg.end:
> ; predecessors: %bb.2, %bb.1
>
> 384B %17:gr32 = ADD32rr %17:gr32(tied-def 0), %18:gr32, implicit-def dead $eflags, debug-location !41; phi.ll:12:1
> DBG_VALUE %18:gr32, $noreg, !"15", !DIExpression(), debug-location !50; phi.ll:21:1 line no:21 // Seems still works here. (not "drop the DBG_VALUE ")
> 400B $eax = COPY %17:gr32, debug-location !51; phi.ll:23:1
> 416B RETQ implicit killed $eax, debug-location !51; phi.ll:23:1
> ____________________________________________________
Indeed; it's LiveDebugVariables that drops out-of-liveness DBG_VALUEs, as seen here:
https://github.com/llvm/llvm-project/blob/68ac02c0dd2b8fda52ac132a86f72f2ad6b139a5/llvm/lib/CodeGen/LiveDebugVariables.cpp#L657
as the register allocator will not maintain the location of its vreg for positions that aren't live.
--
Thanks,
Jeremy
More information about the llvm-dev
mailing list