This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/20367] alias analysis doesn't take into account that variables that haven't their address taken can't alias arbitrary MEMs
- From: "dnovillo at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Mar 2005 01:36:45 -0000
- Subject: [Bug rtl-optimization/20367] alias analysis doesn't take into account that variables that haven't their address taken can't alias arbitrary MEMs
- References: <20050307194707.20367.amylaar@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dnovillo at redhat dot com 2005-03-08 01:36 -------
Subject: Re: alias analysis doesn't take into
account that variables that haven't their address taken can't alias arbitrary
MEMs
pinskia at gcc dot gnu dot org wrote:
> void g();
> int
> f(int s, int *a)
> {
> static int i;
> for (i = 0; i < 800; i++)
> {
> g();
> s += a[i];
> }
> return s;
> }
>
> But all of this needs to be on the tree level to be really effective.
>
This particular case is trivial to fix inside the tree optimizers.
Variable 'i' is a local variable with static storage that is not upward
exposed (i.e., it has no default definition).
Once you recognize that, you can safely flip the TREE_STATIC bit on the
variable and expose it as a gimple register.
Diego.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20367