[PATCH] Fix PR27743

Roger Sayle roger@eyesopen.com
Thu May 25 04:58:00 GMT 2006


Hi Richard,

On Wed, 24 May 2006, Richard Guenther wrote:
> 2006-05-24  Richard Guenther  <rguenther@suse.de>
>
> 	PR middle-end/27743
> 	* fold-const.c (fold_binary): Do not look at the stripped
> 	op0 for (a OP c1) OP c2 to a OP (c1+c2) shift optimization.
>
> 	* gcc.dg/torture/pr27743.c: New testcase.

This is OK for mainline, and 4.1.2 after the branch reopens.  The
code as written clearly assumes TREE_TYPE (TREE_OPERAND (arg0, 0))
is type.

For 4.3, we can look into unfactoring the "shift:" hunk of fold_binary,
which will simplify the task of handling (cast)(a OP c1) OP c2, when
such combinations permit simplification/optimization.  For example,
when OP is LSHIFT_EXPR we can do more than when OP is RSHIFT_EXPR.

Thanks for fixing this.

Roger
--



More information about the Gcc-patches mailing list