https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Perhaps slsr should then if it is considering Y = B + (i' * S) X = B + (i * S) to Y = B + (i' * S) X = Y + (i - i') * S and if i and i' are INTEGER_CSTs call choose_mult_variant on both i and (i - i') and see which one is more expensive (of course, even before that with the check that power of 2 multiplication is always faster than anything else, as expand_mult uses that unconditionally).