This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Fix PR middle-end/59049
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Joern Rennecke <joern dot rennecke at embecosm dot com>
- Cc: Steven Bosscher <stevenb dot gcc at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 11 Nov 2013 15:40:46 +0100
- Subject: Re: RFA: Fix PR middle-end/59049
- Authentication-results: sourceware.org; auth=none
- References: <CAMqJFCqWDNTjmJ11p-LGE4vBPQ7gBSLWY3prXFNv7+QUoL_ipw at mail dot gmail dot com> <CABu31nOfNL0ysg-zCTO=txx_SYv_n5XU3M2hFB-NxsgRW2hwGg at mail dot gmail dot com> <CAMqJFCrtSXDvCZE=E2VP1xsTf7o6OdCn=KsQ9hV0LO6BO=BD+w at mail dot gmail dot com> <CABu31nP7N8=3AU-3Nwc8rGT-VePL3eHx+u_eAPoCBz+Cse1vWg at mail dot gmail dot com> <20131108154149 dot GQ27813 at tucnak dot zalov dot cz> <CABu31nOgHU_5+FEcCBnYxG50WzU1M=cbPKVD7y41FSPJO7MwXA at mail dot gmail dot com> <CAMqJFCpZqU=7Hf0q6vL-pLExZXdk8r+m5Wfwit5-Nu2L2WDN8w at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Nov 08, 2013 at 05:11:39PM +0000, Joern Rennecke wrote:
> On 8 November 2013 15:50, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> > Even with the gimple opts disabled, a const-const comparison would
> > normally be folded by the RTL expanders.
>
> Well, in this spirit, attached is another way to address the RTL side
> of the problem.
> As mention in the PR, the tree side of the problem started showing up
> in r204194.
> 2013-11-08 Joern Rennecke <joern.rennecke@embecosm.com>
>
> PR middle-end/59049
> * expmed.c (emit_store_flag): Fail for const-const comparison.
LGTM (I'd just write return NULL_RTX; instead of return 0;).
> --- expmed.c (revision 204568)
> +++ expmed.c (working copy)
> @@ -5401,6 +5401,13 @@ emit_store_flag (rtx target, enum rtx_co
> rtx subtarget;
> rtx tem, last, trueval;
>
> + /* If we compare constants, we shouldn't use a store-flag operation,
> + but a constant load. We can get there via the vanilla route that
> + usually generates a compare-branch sequence, but will in this case
> + fold the comparison to a constant, and thus elide the branch. */
> + if (CONSTANT_P (op0) && CONSTANT_P (op1))
> + return 0;
> +
> tem = emit_store_flag_1 (target, code, op0, op1, mode, unsignedp, normalizep,
> target_mode);
> if (tem)
Jakub