https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106883
--- Comment #13 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:c01ad7a27af18f430639b6ec9597199eb655cc76 commit r16-7003-gc01ad7a27af18f430639b6ec9597199eb655cc76 Author: Andrew Pinski <[email protected]> Date: Fri Jan 16 20:50:53 2026 -0800 slsr: Fix replace_rhs_if_not_dup and others for overflow [PR106883] Like the previous patch this up slsr in the other locations for the added overflow issues that were being introduced. This was slightly harder than insert_initializers as we need to allow for type mismatches in more cases. But with this all fixed, the testcases in PR 120258 (and its duplicates) are all working correctly. Bootstrapped and tested on x86-linux-gnu. PR tree-optimization/120258 PR tree-optimization/106883 gcc/ChangeLog: * gimple-ssa-strength-reduction.cc (replace_mult_candidate): Allow for basis_name and bump_tree not to be the same type as the lhs. Rewrite added multiply for undefined overflow. (create_add_on_incoming_edge): Allow for init to be a different type from the wanted type. Rewrite added add for undefined overflow. (replace_rhs_if_not_dup): Rewrite replaced stmts for undefined overflow. (replace_one_candidate): Allow for basis_name and rhs2 to be a different type from lhs. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/slsr-8.c: Update the number of `*`. * gcc.dg/torture/pr120258-1.c: New test. Signed-off-by: Andrew Pinski <[email protected]>
