RFA: Fix PR middle-end/59049
Eric Botcazou
ebotcazou@adacore.com
Mon Nov 11 11:33:00 GMT 2013
> In this case it's fold-all-builtins folding a strlen call with a
> PHI <"foo", "bar"> argument. IMHO not presenting RTL with such
> non-sense is best achieved by not letting TER do constant propagation
> (because it doesn't "fold" the result). We can never rule out such
> stray non-propagated constants, so that makes expand more robust
> (and hopes for RTL CCP).
>
> Index: gcc/tree-ssa-ter.c
> ===================================================================
> --- gcc/tree-ssa-ter.c (revision 204664)
> +++ gcc/tree-ssa-ter.c (working copy)
> @@ -438,6 +439,12 @@ ter_is_replaceable_p (gimple stmt)
> && !is_gimple_val (gimple_assign_rhs1 (stmt)))
> return false;
>
> + /* Do not propagate "modeless" constants - we may end up
> confusing the RTL
> + expanders. Leave the optimization to RTL CCP. */
> + if (gimple_assign_single_p (stmt)
> + && CONSTANT_CLASS_P (gimple_assign_rhs1 (stmt)))
> + return false;
> +
> return true;
> }
> return false;
>
> does that make sense? I'll test it then.
I agree with Joern that we want more constant propagation/folding during
RTL expansion, not less, so IMO that's the wrong direction.
--
Eric Botcazou
More information about the Gcc-patches
mailing list