This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Implement the easy part of -fargument-noalias-global
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 6 Apr 2005 17:58:10 -0400
- Subject: [PATCH] Implement the easy part of -fargument-noalias-global
The following patch implements the easiest part of
-fargument-noalias-global,
which we can represent in the current tree aliasing infrastructure.
Say we have the following C code:
int f;
void link_error ();
void g(int *i)
{
*i = 0;
f = 1;
if (*i != 0)
link_error ();
}
With -fargument-noalias-global, we know that *i cannot point to f.
This patch
enables that fact in may_alias. So we should be able to remove the
conditional.
In fact we already do it at the RTL level but since we have more
aliasing
information at the tree level, this would enable for more optimizations
which
we don't catch to the RTL level.
OK? Bootstrapped and tested on powerpc-darwin with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* tree-ssa-alias.c (may_alias_p): If the variable is a global variable
and the pointer is parameter and -fargument-noalias-global is used,
then
the pointer cannot alias the variable.
Attachment:
temp.diff.txt
Description: Text document