This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR27743
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 24 May 2006 17:46:44 -0600 (MDT)
- Subject: Re: [PATCH] Fix PR27743
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
--