[PATCH] Improve cost computations in IVOPTS

Eric Botcazou ebotcazou@adacore.com
Mon May 25 15:41:00 GMT 2009


> > Tested on i586-suse-linux, OK for mainline?
>
> +      if (TREE_CODE (op1) != INTEGER_CST)
> +       return orig_expr;
>
> should test host_integerp (op1, 0).

You're right.  In fact, the file uses the sophisticated cst_and_fits_in_hwi / 
int_cst_value devices so I presume this should be something like:

    case MULT_EXPR:
      op1 = TREE_OPERAND (expr, 1);
      if (!cst_and_fits_in_hwi (op1))
	return orig_expr;

      op0 = TREE_OPERAND (expr, 0);
      op0 = strip_offset_1 (op0, false, false, &off0);
      if (op0 == TREE_OPERAND (expr, 0))
	return orig_expr;

      *offset = off0 * int_cst_value (op1);
      if (integer_zerop (op0))
	expr = op0;
      else
	expr = fold_build2 (MULT_EXPR, type, op0, op1);

      return fold_convert (orig_type, expr);


-- 
Eric Botcazou



More information about the Gcc-patches mailing list