https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120805

--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <tnfch...@gcc.gnu.org>:

https://gcc.gnu.org/g:4a65ae52bacade00989f9840aab5ae11c4ef19f9

commit r16-2685-g4a65ae52bacade00989f9840aab5ae11c4ef19f9
Author: Tamar Christina <tamar.christ...@arm.com>
Date:   Thu Jul 31 15:29:30 2025 +0100

    vect: Don't set bogus bounds on epilogues [PR120805]

    The testcases in the PR are failing due to the code trying to set a vector
range
    on an epilogue.

    However on epilogues the range doesn't make sense.  In particular we are
setting
    ranged to help niters analysis. But the epilogue doesn't iterate.

    Secondly the bounds variable hasn't been adjusted to vector iterations:

    In the epilogue this is calculated as

      <bb 13> [local count: 81467476]:
      # i_127 = PHI <tmp.7_131(10), 0(5)>
      # _132 = PHI <_133(10), 0(5)>
      _181 = (unsigned int) n_41(D);
      bnd.31_180 = _181 - _132;

    where

      _133 = niters_vector_mult_vf.6_130;

    but _132 is a phi node, and if coming from the vector loop skip edge
    _181 will be <1, VF>.

    But this is a range VRP or Ranger can easily report due to the guard on the
    skip_vector loop.

    Previously, non-const VF would skip this code entirely due to the
.is_constant()
    check.

    Non-partial vector loop would also skip it because the bounds would fold to
a
    constant. so it doesn't enter the !gimple_value check.

    When support for partial vector ranges was added, this accidentally enabled
    ranges on partial vector epilogues.

    This patch now makes it explicit that ranges shouldn't be set for
epilogues, as
    they don't seem to be useful anyway.

    gcc/ChangeLog:

            PR tree-optimization/120805
            * tree-vect-loop-manip.cc (vect_gen_vector_loop_niters): Skip
setting
            bounds on epilogues.

Reply via email to