This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Little infrastructure for IP constant propagation
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jan Hubicka" <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Sat, 23 Aug 2008 21:41:42 +0200
- Subject: Re: Little infrastructure for IP constant propagation
- References: <20080823193323.GP9952@kam.mff.cuni.cz>
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.