Hi Honza, > On 12 Dec 2025, at 9:04 am, Kugan Vivekanandarajah <[email protected]> > wrote > How about going with something like: > copyid_base = allocate_copyid_base (loc, base_discriminator); > This should have global context and allocate new copyid_base for each call > without any of the defines we have now. > This would still have issue for LTO where any copyid_base generated in LTRANS > will have conflict unless we generate this > in WPA and stream. What do you think?
Here is the implementation (just the patch 1 or the infrastructure). Do you
prefer this?
Using this API, we would assign copy_id like:
+ gimple *nloop_last = last_nondebug_stmt (nloop->header);
+ location_t nloop_loc
+ = nloop_last ? gimple_location (nloop_last) : UNKNOWN_LOCATION;
+ if (nloop_loc != UNKNOWN_LOCATION)
+ {
+ unsigned int nloop_copyid = allocate_copyid_base (nloop_loc, 1);
+ assign_discriminators_to_loop (nloop, 0, nloop_copyid);
+ }
I will post the series based on this if you prefer this.
Thanks,
Kugan
0001-Autofdo-V3-Add-hierarchical-discriminator-support.patch
Description: 0001-Autofdo-V3-Add-hierarchical-discriminator-support.patch
