Little infrastructure for IP constant propagation

Richard Guenther richard.guenther@gmail.com
Sat Aug 23 20:17:00 GMT 2008


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?

Otherwise this is ok.

Thanks,
Richard.



More information about the Gcc-patches mailing list