This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve lim for pulling loads from global variable outof loops
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>, "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 12 Nov 2004 10:18:32 -0500
- Subject: Re: [PATCH] Improve lim for pulling loads from global variable outof loops
- Organization: Red Hat Canada
- References: <1100271825.20892.2.camel@localhost.localdomain> <20041112150902.GA19840@atrey.karlin.mff.cuni.cz>
On Fri, 2004-11-12 at 10:09, Zdenek Dvorak wrote:
> Hello,
>
> > > * tree-ssa-loop-im.c (stmt_cost): Gimple variables should be
> > > pulled out too as they cause memory accesses.
> > >
> > Your ChangeLog entry doesn't match the code. Also, testing only for
> > is_gimple_addressable will not include global variables. You want to
> > test is_global_var.
>
> Diego, I think you are wrong in both points -- is_gimple_addressable
> includes global variables (any variables, in fact), and the changelog
> entry seems to match the change.
>
You're right, I didn't express myself correctly. Andrew said he wanted
to consider global variables expensive. Globals are addressable, but
not every addressable is a global.
> However the patch is wrong -- is_gimple_addressable also matches SSA
> names. So the right patch should be
>
I thought the intent was to only mark globals as expensive? I think I
would just say:
if (!is_gimple_reg (rhs))
cost += 20;
Diego.