This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR30137, folding of addresses of components
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 31 Dec 2006 09:40:34 -0700 (MST)
- Subject: Re: [PATCH] Fix PR30137, folding of addresses of components
Hi Richard,
On Sun, 31 Dec 2006, Richard Guenther wrote:
> This enables us to fold a == &a.c and related comparisons that are
> handled by get_inner_reference.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, will apply to
> mainline in a few days if nobody objects.
You should probably also add a new testcase that uses ordering rather
than just equality/inequality comparisons. Many examples of the latter
should already be handled via operand_equal_p, and indeed foo4, foo5,
and foo6 of your new pr30137-2.c, pass even without your patch. In
fact, this suggests that we should probably also improve operand_equal_p
to understand that "s" and "&s->base" are equivalent. This would
resolve the PR as posted in a more generic way, but I agree your
enhancements to fold_comparison enable even more simplifications,
especially those for ordering comparisons [hence the request for more
testcases].
Thanks for fixing this. Feel free to commit it to the tree today.
Roger
--