https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125291
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Xi Ruoyao <[email protected]>: https://gcc.gnu.org/g:25fe4e719d0689ab7e38ddaed02c90d1b70ef138 commit r16-8919-g25fe4e719d0689ab7e38ddaed02c90d1b70ef138 Author: Xi Ruoyao <[email protected]> Date: Wed May 13 00:22:15 2026 +0800 scev: Sign extend step in peeled converted IV handling [PR 125291] 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): Sign-extend the step for peeled converted IV. gcc/testsuite/ * gcc.c-torture/execute/pr125291.c: New test. (cherry picked from commit 26aae2119eb79bfbea23b86ea1a58f9a3a0911a6)
