[PATCH] D16569: Emit line 0 line information for interesting 'orphan' instructions

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 15:49:39 PST 2016

probinson added inline comments.

Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1043
@@ -1036,3 +1042,3 @@
         PrevInstLoc = DL;
         recordSourceLine(0, 0, nullptr, 0);
probinson wrote:
> Passing nullptr here looks like it will force the file number to 1.  Often it is 1 anyway, but not necessarily, e.g. for an inline function definition in a header file.  If it isn't already 1 then we'll waste space setting the file to 1 and back for no benefit.  To save space in the encoded line table, we should pass Scope here.
> This didn't really matter so much when UnknownLocations was the only way to get these directives, but now we're doing it "normally" so it matters more.
Heh. Scope would have to come from PrevInstLoc, if defined, of course;
`const MDNode *Scope = PrevInstLoc ? PrevInstLoc.getScope() : nullptr;`
but still easy enough.
Wolfgang reports that this reduces the size-increase from 40% to 29%, or if we have already taken out LastWasCall, from 18% to 15%.  This is all at -O0.


More information about the llvm-commits mailing list