[patch] Perform anonymous constant propagation during inlining

Eric Botcazou ebotcazou@adacore.com
Fri May 1 18:11:00 GMT 2015


> OK, how aggressive then?  We could as well do the substitution for all
> copies:
> 
>       /* 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.

Tested on x86_64-suse-linux, OK for the mainline?


2015-05-01  Eric Botcazou  <ebotcazou@adacore.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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 1388 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150501/dd74bd53/attachment.bin>


More information about the Gcc-patches mailing list