Ping

> -----Original Message-----
> From: Alex Coplan <alex.cop...@arm.com>
> Sent: Monday, January 6, 2025 11:35 AM
> To: gcc-patches@gcc.gnu.org
> Cc: Richard Biener <rguent...@suse.de>; Jan Hubicka <hubi...@ucw.cz>; Tamar
> Christina <tamar.christ...@arm.com>
> Subject: [PATCH 3/4] vect: Ensure profile consistency when adding epilog guard
> [PR117790]
> 
> This patch tries to make the CFG profile consistent when adding a guard
> edge to skip the epilog during peeling.
> 
> The changes can be summarized as follows:
>  - We avoid adding the guard edge entirely if the guard condition folds
>    to false, otherwise the profile will become inconsistent since
>    the cfgcleanup code doesn't attempt to update it on removing the dead
>    edge.
>  - If the guard condition instead folds to true, we account for this by
>    giving the skip edge 100% probability (otherwise the profile will
>    again become inconsistent when removing the other now-dead edge).
>  - Finally, we use the new helper scale_loop_freqs_with_new_exit_count instead
>    of scale_loop_profile to update the epilog frequencies / probabiltiies.
>    We make the assumption here that if the IV exit is taken in the vector 
> loop,
>    then it will also be taken in the epilog (and not an early exit).  Since we
>    add the guard to the vector iv exit, we know any reduction in count
>    associated with the epilog skip should be accounted for by a reduction in 
> the
>    epilog's iv exit edge count.
> 
> Bootstrapped/regtested as a series on aarch64-linux-gnu, arm-linux-gnueabihf,
> and x86_64-linux-gnu.  OK for trunk?
> 
> Thanks,
> Alex
> 
> gcc/ChangeLog:
> 
>       PR tree-optimization/117790
>       * tree-vect-loop-manip.cc (vect_do_peeling): Attempt to maintain
>       consistency of the CFG profile when adding an epilog skip edge.
> 
> gcc/testsuite/ChangeLog:
> 
>       PR tree-optimization/117790
>       * gcc.dg/vect/vect-early-break-profile-1.c: New test.
> ---
>  .../gcc.dg/vect/vect-early-break-profile-1.c  | 10 ++++
>  gcc/tree-vect-loop-manip.cc                   | 48 ++++++++++++++-----
>  2 files changed, 47 insertions(+), 11 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-early-break-profile-1.c

Reply via email to