[PATCH] Add instruction level discriminator support.

Eugene Rozenfeld Eugene.Rozenfeld@microsoft.com
Thu Jun 2 07:21:39 GMT 2022


This is the first in a series of patches to enable discriminator support
in AutoFDO.

This patch switches to tracking discriminators per statement/instruction
instead of per basic block. Tracking per basic block was problematic since
not all statements in a basic block needed a discriminator and, also, later
optimizations could move statements between basic blocks making correlation
during AutoFDO compilation unreliable. Tracking per statement also allows
us to assign different discriminators to multiple function calls in the same
basic block. A subsequent patch will add that support.

The idea of this patch is based on commit 4c311d95cf6d9519c3c20f641cc77af7df491fdf
by Dehao Chen in vendors/google/heads/gcc-4_8 but uses a slightly different
approach. In Dehao's work special (normally unused) location ids and side tables
were used to keep track of locations with discriminators. Things have changed
since then and I don't think we have unused location ids anymore. Instead,
I made discriminators a part of ad-hoc locations.

The difference from Dehao's work also includes support for discriminator
reading/writing in lto streaming and in modules.

Tested on x86_64-pc-linux-gnu.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-instruction-level-discriminator-support.patch
Type: application/octet-stream
Size: 31949 bytes
Desc: 0001-Add-instruction-level-discriminator-support.patch
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20220602/d35ce442/attachment-0001.obj>


More information about the Gcc-patches mailing list