Index: gcc/tree-ssa-loop-ivopts.c =================================================================== --- gcc/tree-ssa-loop-ivopts.c (revision 227163) +++ gcc/tree-ssa-loop-ivopts.c (working copy) @@ -3884,12 +4038,14 @@ get_shiftadd_cost (tree expr, machine_mode mode, c int m = exact_log2 (int_cst_value (cst)); int maxm = MIN (BITS_PER_WORD, GET_MODE_BITSIZE (mode)); int as_cost, sa_cost; - bool mult_in_op1; + bool mult_in_op1 = false; if (!(m >= 0 && m < maxm)) return false; - mult_in_op1 = operand_equal_p (op1, mult, 0); + if (operand_equal_p (op1, mult, 0) + || operand_equal_p (STRIP_NOPS (op1), mult, 0)) + mult_in_op1 = true; as_cost = add_cost (speed, mode) + shift_cost (speed, mode, m);