> On 15 Nov 2025, at 8:36 am, Kugan Vivekanandarajah <[email protected]> 
> wrote:
> 
> External email: Use caution opening links or attachments
> 
> 
> Hi,
> 
>>> 
>>> I think we want to solve two problems
>>> 1) Handle situation when statement is duplicated (unrolling, loop
>>>  header copying etc.) and thus different locations in program
>>>  corresponds to different copies.
>>> 
>>>  Current code simply picks address with maximal count (expecting that
>>>  the statemnt perhaps spans multiple BBs) while we should really sum
>>>  counts of execution of different copies.
>>> 1) Handle situation where single address implies multiple executions
>>>  of the same statement (i.e. after vectorization)
>>> 
> 
> Here is the revised patch-set. In this:2
> 1. I have dropped gcov changes to 32bit discriminator. Instead  I have 
> changed autofdo tools to handle multiplicity and copy-id.
> I have put-up a pull request to autfdo tools as 
> https://github.com/google/autofdo/pull/257. This means all the changes to 
> auto-profile pass is not needed for this.
> We could still add 32bit support if there is a need as a follow up.
> 
> I have the split the patch into
> 1. Hierarchical discriminate support
> 2. Change vectoriser to add hierarchal discriminator
> 3. Adding hierarchical discriminate for loop versioning
> 4. Adding hierarchical discriminate for loop unrolling
> 

This patch adds hierarchical discriminator support for loop unrolling.
Assigns multiplicity and copyid discriminators to distinguish unrolled
iterations.

gcc/ChangeLog:

        * cfgloopmanip.cc (duplicate_loop_body_to_header_edge): Assign
        hierarchical discriminators for loop unrolling.
        * cfgloopmanip.h (DLTHE_RECORD_HIERARCHICAL_DISCRIMINATOR): New flag.
        * tree-ssa-loop-ivcanon.cc (try_unroll_loop_completely): Pass flag
        to enable hierarchical discriminator assignment.
        (try_peel_loop): Likewise.

gcc/testsuite/ChangeLog:

        * gcc.dg/hierarchical-discriminator-unroll.c: New test.

Signed-off-by: Kugan Vivekanandarajah <[email protected]>

Thanks,
Kugan

Attachment: 0004-Autofdo-Add-hierarchical-discriminator-for-loop-unro.patch
Description: 0004-Autofdo-Add-hierarchical-discriminator-for-loop-unro.patch

Reply via email to