On Thu, 2026-05-14 at 09:29 +0800, Xi Ruoyao wrote:
> For 3 iterations of
>
> unsigned char flagbits;
> _877 = flagbits_832 + 254;
> _879 = (int) _877;
> # prephitmp_880 = PHI <_879(40), 6(41)>
> _70 = _68 >> prephitmp_880;
>
> The peeled converted IV handling added in r16-3562 incorrectly
> analyzes
> it as [6, 6 + 254, 6 + 254 * 2] instead of [6, 4, 2]. Then VRP uses
> the
> intersect of {6, 560, 514} and {2, 4, 6}, i.e. {6} as the possible
> value
> range, and propagates the constant 6 for _70.
>
> Extend the step (for example, 254 => -2) to fix the issue.
>
> PR tree-optimization/125291
>
> gcc/
>
> * tree-scalar-evolution.cc (simplify_peeled_chrec): Reject
> the
> un-converted IV if it's direction is different from the
> converted one.
Oops, I forgot to update this message. v2 will come soon.
--
Xi Ruoyao <[email protected]>