[PATCH] D25456: [InstrProf] Add support for dead_strip+live_support functionality

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 22:21:53 PDT 2016


davidxl added inline comments.


================
Comment at: include/llvm/ProfileData/InstrProf.h:58
   return AddSegment ? "__DATA," INSTR_PROF_DATA_SECT_NAME_STR
+                      ",regular,live_support"
                     : INSTR_PROF_DATA_SECT_NAME_STR;
----------------
vsk wrote:
> mehdi_amini wrote:
> > davidxl wrote:
> > > What is the exact meaning of this attribute? Does it mark the section 'not' the  root of the reference graph (which allows symbols just referenced from this section to be GCed)?
> > > 
> > > Garbage collection for dead function (with profile instrumentation) is currently also broken on Linux because -fdata-sections is not honored by for prof data symbols.
> > I see this section as "reversing" the edges in the dead-strip algorithm: if a symbol foo is in the live_support section, the linker will keep it alive if the symbols *referenced by* foo are live.
> > (Nothing is expected to reference foo).
> This is better than my explanation, thanks Mehdi :).
> 
> It's true that symbols referenced by data in a "live_support" section may be GC'd, but it's only interesting the other way: if we could GC a symbol by not treating "live_support" uses as "critical", then we GC the symbol and its uses.
The reversing edge is a good way to explain it -- which has two effects:
1) the references from the section is ignored
2) if the section ends up referencing non or only dead symbols, it is dead too.

Note that all per-function prof data are put in the same section -- so the second effect won't kick in unless fdata-sections is effective too.


https://reviews.llvm.org/D25456





More information about the llvm-commits mailing list