This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Track discriminators by instruction instead of by basic block
> What's a discriminator? ?Why is it worth bloating locations with it?
A discriminator is a small integer that helps distinguish instructions
for profiling purposes, when code on two different logical paths
belongs to the same line. This allows sample-based profile information
to be attributed accurately to the appropriate basic blocks during
optimization. This is a new feature of the DWARF-4 line number table;
there's a full writeup on the DWARF wiki:
http://wiki.dwarfstd.org/index.php?title=Path_Discriminators
> How much more memory do we need when keeping discriminators
> with LTO (which you don't - patches to lto-streamer-{in,out} are missing).
Not a lot. We assign discriminators for only a small fraction of the
total number of locations in the program, so the number of unique
location_t values doesn't increase significantly. I didn't add
anything to the line_map structure, nor did I do anything at all in
libcpp, so it's not bloating the source_location/location_t data
structures at all. The extra space needed is linear with the number of
discriminators assigned, which is roughly one per for loop or switch
statement, plus an occasional discriminator for conditional
expressions or macro expansions with control flow. (In the old code
that I'm replacing, the extra space was one int per basic block.)
Yes, I do need to deal with this in the lto streamer -- thanks for
pointing that out.
-cary