[llvm] r232332 - [MCDwarf] Do not emit useless line table opcode.

David Blaikie dblaikie at gmail.com
Mon Mar 16 08:29:01 PDT 2015


On Sun, Mar 15, 2015 at 1:45 PM, Frederic Riss <friss at apple.com> wrote:

> Author: friss
> Date: Sun Mar 15 15:45:39 2015
> New Revision: 232332
>
> URL: http://llvm.org/viewvc/llvm-project?rev=232332&view=rev
> Log:
> [MCDwarf] Do not emit useless line table opcode.
>
> No need to emit a DW_LNS_advance_pc with a 0 increment. Found out while
> comparing dsymutil's and LLVM's line table encoding. Not a correctenss
> fix, just a small encoding size optimization.
>
> I'm not sure how to generate a sequence that triggers this, and moreover
> llvm-dwardump doesn't dump the line table program, thus the effort
> involved in creating a testcase for this trivial patch seemed out of
> proportion.
>

Still, nice to test optimizations, if you want them to hold/not regress. In
this case, since it doesn't affect the resulting line table description (in
terms of what dwarfdump would print - if I undrestand you correctly?) it
might be appropriate to do a raw assembly test (or, if you're going to be
debugging line table program issues - introducing a new dumping format that
prints the actual line table program, rather than the table generated by
the program, might be useful)

As for the sequence that triggers this - I guess you had some test case you
were rurnning where you observed this behavior?


>
> Modified:
>     llvm/trunk/lib/MC/MCDwarf.cpp
>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=232332&r1=232331&r2=232332&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Sun Mar 15 15:45:39 2015
> @@ -446,7 +446,7 @@ void MCDwarfLineAddr::Encode(MCContext &
>    if (LineDelta == INT64_MAX) {
>      if (AddrDelta == MAX_SPECIAL_ADDR_DELTA)
>        OS << char(dwarf::DW_LNS_const_add_pc);
> -    else {
> +    else if (AddrDelta) {
>        OS << char(dwarf::DW_LNS_advance_pc);
>        encodeULEB128(AddrDelta, OS);
>      }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150316/8966c329/attachment.html>


More information about the llvm-commits mailing list