This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 4/5] Fix indirect inlining fallout with new intra-SRA
Hi,
On Tue, Apr 28, 2009 at 01:48:55PM +0200, Richard Guenther wrote:
> On Tue, Apr 28, 2009 at 12:04 PM, Martin Jambor <mjambor@suse.cz> wrote:
> > The new intra-SRA produces an extra copy assignment and that breaks
> > ipa-prop.c pattern matching. The following patch fixes that.
> >
> > Thanks,
> >
> > Martin
> >
> >
> > 2009-04-27 Martin Jambor <mjambor@suse.cz>
> >
> > * ipa-prop.c (get_ssa_def_if_simple_copy): New function.
> > (determine_cst_member_ptr): Call get_ssa_def_if_simple_copy to skip
> > simple copies.
> >
> >
> > Index: mine/gcc/ipa-prop.c
> > ===================================================================
> > --- mine.orig/gcc/ipa-prop.c
> > +++ mine/gcc/ipa-prop.c
> > @@ -456,6 +456,22 @@ fill_member_ptr_cst_jump_function (struc
> > jfunc->value.member_cst.delta = delta;
> > }
> >
> > +/* If RHS is an SSA_NAMe and it is defined by a simple copy assign statement,
> > + return the rhs of its defining statement. */
> > +
> > +static inline tree
> > +get_ssa_def_if_simple_copy (tree rhs)
> > +{
> > + if (TREE_CODE (rhs) == SSA_NAME && !SSA_NAME_IS_DEFAULT_DEF (rhs))
> > + {
> > + gimple def_stmt = SSA_NAME_DEF_STMT (rhs);
> > +
> > + if (is_gimple_assign (def_stmt) && gimple_num_ops (def_stmt) == 2)
> > + rhs = gimple_assign_rhs1 (def_stmt);
> > + }
> > + return rhs;
> > +}
>
> IMHO this function should loop. Also use gimple_assign_single_p
> instead of the assign && num_ops check.
OK
> You also have to check the gimple_assign_rhs_code to be SSA_NAME,
> otherwise you happily look through all unary operations.
>
Will the RHS code be SSA_NAME even when the RHS is an invariant? (I am
eventually looking for an invariant, specifically an ADDR_EXPR of a
FUNCTION_DECL and an integer constant, not an ssa name.)
Thanks,
Martin