This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, 4.6] Enable IPA-CP to propagate &CONST_DECLs


On Fri, Mar 19, 2010 at 02:14:13PM +0100, Richard Guenther wrote:
> On Fri, Mar 19, 2010 at 2:02 PM, Martin Jambor <mjambor@suse.cz> wrote:
> > Hi,
> >
> > I thought that IPA-CP was already able to propagate fortran
> > &CONST_DECLs but yesterday I have observed it cannot. ÂI also found
> > out the only piece that was missing was the lattice meet operation
> > which did not consider the same constants as equal.
> >
> > The patch below adds this capability and with it (and -fwhole-program
> > -flto) I can see such constants propagated in every polyhedron
> > benchmark (I have not got to any execution-time measurements though).
> >
> > Bootstrapped and regression tested on current trunk, I'd like to
> > commit it once stage 1 opens again (I have added this to the queue
> > before my devirtualization patches, many of them need some very slight
> > changes because of the thunks in dumping).
> 
> This is ok for stage1.

Committed as revision 158176.

Thanks,

Martin

> 
> Thanks,
> Richard.
> 
> > Thanks,
> >
> > Martin
> >
> >
> > 2010-03-18 ÂMartin Jambor Â<mjambor@suse.cz>
> >
> > Â Â Â Â* ipa-cp.c (ipcp_lats_are_equal): Return true also if the two
> > Â Â Â Âlattices are addresses of CONST_DECLs with the same initial value.
> > Â Â Â Â(ipcp_print_all_lattices): Print values of CONST_DECLs.
> > Â Â Â Â* ipa-prop.c (ipa_print_node_jump_functions): Likewise.
> >
> > Index: icln/gcc/ipa-cp.c
> > ===================================================================
> > --- icln.orig/gcc/ipa-cp.c
> > +++ icln/gcc/ipa-cp.c
> > @@ -226,10 +226,14 @@ ipcp_lats_are_equal (struct ipcp_lattice
> > Â if (lat1->type != lat2->type)
> > Â Â return false;
> >
> > - Âif (operand_equal_p (lat1->constant, lat2->constant, 0))
> > - Â Âreturn true;
> > -
> > - Âreturn false;
> > + Âif (TREE_CODE (lat1->constant) == ÂADDR_EXPR
> > + Â Â Â&& TREE_CODE (lat2->constant) == ÂADDR_EXPR
> > + Â Â Â&& TREE_CODE (TREE_OPERAND (lat1->constant, 0)) == CONST_DECL
> > + Â Â Â&& TREE_CODE (TREE_OPERAND (lat2->constant, 0)) == CONST_DECL)
> > + Â Âreturn operand_equal_p (DECL_INITIAL (TREE_OPERAND (lat1->constant, 0)),
> > + Â Â Â Â Â Â Â Â Â Â Â Â Â DECL_INITIAL (TREE_OPERAND (lat2->constant, 0)), 0);
> > + Âelse
> > + Â Âreturn operand_equal_p (lat1->constant, lat2->constant, 0);
> > Â}
> >
> > Â/* Compute Meet arithmetics:
> > @@ -385,8 +389,16 @@ ipcp_print_all_lattices (FILE * f)
> > Â Â Â Â Âfprintf (f, " Â Âparam [%d]: ", i);
> > Â Â Â Â Âif (lat->type == IPA_CONST_VALUE)
> > Â Â Â Â Â Â{
> > + Â Â Â Â Â Â tree cst = lat->constant;
> > Â Â Â Â Â Â Âfprintf (f, "type is CONST ");
> > - Â Â Â Â Â Â print_generic_expr (f, lat->constant, 0);
> > + Â Â Â Â Â Â print_generic_expr (f, cst, 0);
> > + Â Â Â Â Â Â if (TREE_CODE (cst) == ADDR_EXPR
> > + Â Â Â Â Â Â Â Â && TREE_CODE (TREE_OPERAND (cst, 0)) == CONST_DECL)
> > + Â Â Â Â Â Â Â {
> > + Â Â Â Â Â Â Â Â fprintf (f, " -> ");
> > + Â Â Â Â Â Â Â Â print_generic_expr (f, DECL_INITIAL (TREE_OPERAND (cst, 0)),
> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â0);
> > + Â Â Â Â Â Â Â }
> > Â Â Â Â Â Â Âfprintf (f, "\n");
> > Â Â Â Â Â Â}
> > Â Â Â Â Âelse if (lat->type == IPA_TOP)
> > Index: icln/gcc/ipa-prop.c
> > ===================================================================
> > --- icln.orig/gcc/ipa-prop.c
> > +++ icln/gcc/ipa-prop.c
> > @@ -288,6 +288,13 @@ ipa_print_node_jump_functions (FILE *f,
> > Â Â Â Â Â Â Âtree val = jump_func->value.constant;
> > Â Â Â Â Â Â Âfprintf (f, "CONST: ");
> > Â Â Â Â Â Â Âprint_generic_expr (f, val, 0);
> > + Â Â Â Â Â Â if (TREE_CODE (val) == ADDR_EXPR
> > + Â Â Â Â Â Â Â Â && TREE_CODE (TREE_OPERAND (val, 0)) == CONST_DECL)
> > + Â Â Â Â Â Â Â {
> > + Â Â Â Â Â Â Â Â fprintf (f, " -> ");
> > + Â Â Â Â Â Â Â Â print_generic_expr (f, DECL_INITIAL (TREE_OPERAND (val, 0)),
> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â0);
> > + Â Â Â Â Â Â Â }
> > Â Â Â Â Â Â Âfprintf (f, "\n");
> > Â Â Â Â Â Â}
> > Â Â Â Â Âelse if (type == IPA_JF_CONST_MEMBER_PTR)
> >


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]