This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Q's about use of is_gimple_reg_rhs/is_gimple_tmp_var
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 17 Aug 2004 08:17:04 -0400
- Subject: Re: Q's about use of is_gimple_reg_rhs/is_gimple_tmp_var
- Organization: Red Hat Canada
- References: <10408161215.AA00339@vlsi1.ultra.nyu.edu> <1092719634.2823.8.camel@localhost.localdomain>
On Tue, 2004-08-17 at 01:13, Jeffrey A Law wrote:
> On Mon, 2004-08-16 at 06:15, Richard Kenner wrote:
> > V = foo();
> >
> > If the call to foo does throw, the semantics of throw imply that the
> > assignment to V must not execute. That's why we expand this to:
> >
> > tmp = foo ();
> > V = tmp;
> >
> > Standards are "as if". If there is no other assignment to V, then
> > there's no way to detect if the assignment occurred or not since V's
> > value if it did not occur is undefined.
> Right. That would be a possible optimization. Forcing the LHS to be
> a temporary ensures the condition that were is no other assignment to
> the variable. If you have a clean way to test that this is the only
> assignment to the RHS, then sure, you can avoid the temporary copy.
>
True, but I wouldn't bother, because of ...
> I'm not sure how useful that is since the copy propagator ought to do
> the right thing in the case you're considering.
>
... this. If the copy propagator doesn't get this case, we try and fix
the bug. Let's avoid early micro optimizations.
Diego.