This is the mail archive of the
mailing list for the GCC project.
Re: Aliasing: look through pointer's def stmt
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 25 Oct 2013 12:40:27 +0200 (CEST)
- Subject: Re: Aliasing: look through pointer's def stmt
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1310250707430 dot 14734 at stedding dot saclay dot inria dot fr> <526A0269 dot 8030407 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1310250809590 dot 4165 at laptop-mg dot saclay dot inria dot fr> <CAFiYyc27=sN1itn+N09rpmm8tWGt-Khu7oASLd0ODsdZh=ofzw at mail dot gmail dot com> <CAFiYyc2EtayY0tiW1pz4t-zf0uVC24UcF5s7yaUrY3f7_jxoVg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1310251123350 dot 8620 at laptop-mg dot saclay dot inria dot fr> <CAFiYyc2WmH4WNZ7h8-8iC_6mSO50PdLNLxNzQOYZrYEvn1oQkQ at mail dot gmail dot com>
On Fri, 25 Oct 2013, Richard Biener wrote:
Ah, so you are looking at call_may_clobber_ref_p_1 and its pointer handling
when special-casing builtins?
Note that fields can only be disambiguated
if the size of the access is known
TBAA could also help sometimes.
(not sure what fancy attribute you are going to invent here ...).
That will certainly require quite a bit of discussion...
Generally the simple alias machinery is written to be cheap,
I wouldn't mind an expensive version ;-)
walking use-def chains isn't.
Peeking at the defining statement shouldn't be very costly, as long as you
don't do it recursively.
no need to look at gimple_has_volatile_ops (stmt).
Also you want to handle
p_2 = p_1 + CST;
which has a related canonical form,
p_2 = &MEM[p_1, CST];
This testcase seems relevant, I'll see if I can handle it:
void f (const char *c, int *i)
*i = 42;
__builtin_memcpy (i + 1, c, sizeof (int));
if (*i != 42) __builtin_abort();
The patch is ok with the volatile check removed, you can followup
with handling POINTER_PLUS_EXPR if you like.