This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] fold-const.c merge from mainline
On Mon, Oct 13, 2003 at 07:44:18PM -0600, law@redhat.com wrote:
> >(1) Whilst it is true that CCP only cares about cases when we can fold
> >down to a constant, it is frequently the case that fold reduces an
> >tree expression to a constant but in a number of steps. For example,
> >"(x + 3) - x" can be reduced by "fold" via the recursive call to
> >"(x - x) + 3". Unfortunately, nondestructive_fold_binary_to_constant
> >on the tree-ssa branch isn't able to do this.
> But you don't get those kinds of expressions during CCP. They simply
> don't happen.
Hmm. How about
int x[10];
int *p, *q, t;
p = &x[1];
q = &x[5];
t = q - p;
gimplifies to
p = &x + 4B;
q = &x + 20B;
t = q - p;
ccp's to
t = (&x + 20b) - (&x + 4b)
which is indeed gimple, because &v+c matches is_gimple_val.
This is about the most extreme case we can create, however.
r~