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

Frederic Riss friss at apple.com
Sun Mar 15 13:45:39 PDT 2015


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.

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);
     }





More information about the llvm-commits mailing list