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: Little infrastructure for IP constant propagation


> On Sat, Aug 23, 2008 at 9:33 PM, Jan Hubicka <jh@suse.cz> wrote:
> > Hi,
> > at the moment IPCP is propagating just selected FUNCTION_DECLs constants etc.
> > This patch adds is_gimple_ip_invariant check that is equivalent to is_gimple_min_invariant
> > but verify that value is invariant at interprocedural level; in particular that no addresses
> > of local variables are involved.
> >
> > Bootstrapped/regtested with IP-CP using this predicate. OK?
> 
> 
> > + /* Return whether OP is a DECL whose address is interprocedural-invariant.  */
> > +
> > + bool
> > + decl_address_ip_invariant_p (const_tree op)
> > + {
> > +   /* The conditions below are slightly less strict than the one in
> > +      staticp.  */
> > +
> > +   switch (TREE_CODE (op))
> > +     {
> > +     case LABEL_DECL:
> > +     case FUNCTION_DECL:
> > +     case STRING_CST:
> > +       return true;
> > +
> > +     case VAR_DECL:
> > +       if (((TREE_STATIC (op) || DECL_EXTERNAL (op))
> > +            && !DECL_DLLIMPORT_P (op))
> > +           || DECL_THREAD_LOCAL_P (op))
> > +         return true;
> > +       break;
> 
> Any reason you allow DECL_THREAD_LOCAL_P in general here?

I copied it from decl_address_invariant_p...
Hmm, I am not sure if it is safe in both cases... i.e clone() calls
change addresses of all DECL_THREAD_LOCAL_P variables, right?

Honza
> 
> Otherwise this is ok.
> 
> Thanks,
> Richard.


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