https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128232
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Kewen Lin <[email protected]>: https://gcc.gnu.org/g:1e578c16e98edeb6547b288a19537358d11f5f8a commit r17-5660-g1e578c16e98edeb6547b288a19537358d11f5f8a Author: Xiaomei Xue <[email protected]> Date: Wed Oct 28 11:21:44 2026 +0000 loop-prefetch: Saturate reuse-volume multiplications [PR128232] The reuse-volume calculations can wrap to zero when their results exceed the range of unsigned, leading to incorrect prefetch and non-temporal store decisions. Use saturating multiplication to cap these estimates at UINT_MAX. gcc/ChangeLog: PR tree-optimization/128232 * tree-ssa-loop-prefetch.cc (saturating_mul): New function. (volume_of_dist_vector): Use it. (determine_loop_nest_reuse): Likewise. gcc/testsuite/ChangeLog: PR tree-optimization/128232 * gcc.dg/tree-ssa/pr128232-1.c: New test. * gcc.dg/tree-ssa/pr128232-2.c: New test. Signed-off-by: Xiaomei Xue <[email protected]>
