https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123820
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:d1b30abe52228923ba389173c02c0186d25be1ab commit r16-7051-gd1b30abe52228923ba389173c02c0186d25be1ab Author: Andrew Pinski <[email protected]> Date: Sun Jan 25 22:23:51 2026 -0800 slsr: Use the correct type to try to convert to for inserting on edge case [PR123820] I had noticed there was code that will convert the stride to the correct type What I didn't realize was the type which it was trying to use was stride_type but for this case it should have been using the type of the lhs. This fixes that oversight. Note for pointers we still want to use stride_type like what is done right above. I don't have a testcase that does not use LTO though. I didn't figure out why this testcase needed LTO though. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/123820 gcc/ChangeLog: * gimple-ssa-strength-reduction.cc (create_add_on_incoming_edge): Use the correct type for the stride (lhs if non-pointer). gcc/testsuite/ChangeLog: * g++.dg/torture/pr123820-1.C: New test. Signed-off-by: Andrew Pinski <[email protected]>
