This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2008 19:12:22 -0000
- Subject: [Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition
- References: <bug-37242-7849@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from rguenther at suse dot de 2008-08-27 19:12 -------
Subject: Re: missed FRE opportunity because of
signedness of addition
On Wed, 27 Aug 2008, bonzini at gnu dot org wrote:
> ------- Comment #8 from bonzini at gnu dot org 2008-08-27 17:50 -------
> Subject: Re: missed FRE opportunity because
> of signedness of addition
>
> Maybe we can lookup the non-GIMPLE operands in simplify_unary_expression
> and replace them with existing SSA_NAMES if they have been value numbered.
So when we see
pretmp.36_86 = (unsigned int) maxIdx_24;
we do not even simplify it to (unsigned int)maxIdx_59 + 1.
So much for the fold theory... instead we come from
#9 0x080b75dd in pointer_int_sum (resultcode=PLUS_EXPR, ptrop=0xb7c9d57c,
intop=0xb7ca37a0) at /home/richard/src/trunk/gcc/c-common.c:3361
3361 ret = fold_build2 (POINTER_PLUS_EXPR, result_type, ptrop,
intop);
(gdb) call debug_generic_expr (ptrop)
y + 4
(gdb) call debug_generic_expr (intop)
(unsigned int) ((unsigned int) x * 4)
go through y p+ (4 + (unsigned int) ((unsigned int) x * 4)) which we
fold by fold_plusminus_mult_expr to ((unsigned int) x + 1) * 4.
I saw your patch that adds this folding. And indeed we should
be able to lookup (unsigned int) x + 1 in two steps.
I may look into this at some point.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37242