This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Perform anonymous constant propagation during inlining
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 4 May 2015 10:46:11 +0200
- Subject: Re: [patch] Perform anonymous constant propagation during inlining
- Authentication-results: sourceware.org; auth=none
- References: <6476732 dot lMFodJZTVz at polaris> <0ADD2F35-3576-4FDE-8473-17ADED030B92 at gmail dot com> <3882455 dot jixBbSixVe at polaris> <1538996 dot TcTA0zy8bB at polaris>
On Fri, May 1, 2015 at 8:09 PM, Eric Botcazou <firstname.lastname@example.org> wrote:
>> OK, how aggressive then? We could as well do the substitution for all
>> /* For EXPAND_INITIALIZER try harder to get something simpler.
>> Otherwise, substitute copies on the RHS, this can propagate
>> constants at -O0 and thus simplify arithmetic operations. */
>> if (g == NULL
>> && !SSA_NAME_IS_DEFAULT_DEF (exp)
>> && (optimize || DECL_IGNORED_P (SSA_NAME_VAR (exp)))
>> && (modifier == EXPAND_INITIALIZER
>> || (modifier != EXPAND_WRITE
>> && gimple_assign_copy_p (SSA_NAME_DEF_STMT (exp))))
>> && stmt_is_replaceable_p (SSA_NAME_DEF_STMT (exp)))
>> g = SSA_NAME_DEF_STMT (exp);
> This doesn't work (this generates wrong code because this creates overlapping
> live ranges for SSA_NAMEs with the same base variable). Here's the latest
> working version, all the predicates and accessors used are inlined.
Hum, the fact that your earlier version created wrong code
already returned false here) points at some issues with
EXPAND_INITIALIZER as well, no...?
That said, the path you add is certainly safe (though maybe we want to change
get_gimple_for_ssa_name to return tcc_constant single-use defs even if
TER is disabled
(thus at -O0 - and only at -O0, otherwise it shouldn't happen). That
more cases of get_gimple_for_ssa_name uses (I can see
So, your patch is ok for trunk unless you want to explore the
I also wonder about EXPAND_INITIALIZER creating overlapping
life-ranges (or moving
loads across stores).
> Tested on x86_64-suse-linux, OK for the mainline?
> 2015-05-01 Eric Botcazou <email@example.com>
> * expr.c (expand_expr_real_1) <SSA_NAME>: Try to substitute constants
> on the RHS of expressions.
> * gimple-expr.h (is_gimple_constant): Reorder.
> Eric Botcazou