This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/59049] Two VOIDmode constant in comparison passed to cstoresi4
- From: "amylaar at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 11 Nov 2013 10:47:24 +0000
- Subject: [Bug middle-end/59049] Two VOIDmode constant in comparison passed to cstoresi4
- Auto-submitted: auto-generated
- References: <bug-59049-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59049
--- Comment #8 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> That is, sth like
>
> 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;
Constants are often very valuable for rtl expansion, allowing to use
cheaper patterns.
And some constant propagations are impossible in rtl because of mode
oddities. E.g. when you have a have a mulsidi3 pattern, you generally
have a sign_extend - you can't have a VOIDmode constant inside that.
Therefore, I would rather have the middle-end move the constants
to registers only when necessary to preserve the mode, and preferrably
fold instead in the first place when optimizing.