This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA] [PATCH][PR tree-optimization/59749] Fix recently introduced ree bug
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Jan 2014 23:07:41 +0100
- Subject: Re: [RFA] [PATCH][PR tree-optimization/59749] Fix recently introduced ree bug
- Authentication-results: sourceware.org; auth=none
- References: <52D067EF dot 7020005 at redhat dot com> <20140110215227 dot GJ892 at tucnak dot redhat dot com> <52D38607 dot 4090700 at redhat dot com> <1664880 dot Zr9CfWiqlj at polaris> <52D84F9D dot 8050503 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jan 16, 2014 at 02:31:09PM -0700, Jeff Law wrote:
> +2014-01-16 Jeff Law <law@redhat.com>
> +
> + * ree.c (combine_set_extension): Correct test for changing number
> + of hard registers when widening a reaching definition.
> +
> 2014-01-16 Bernd Schmidt <bernds@codesourcery.com>
>
> PR middle-end/56791
> diff --git a/gcc/ree.c b/gcc/ree.c
> index 19d821c..96cddd2 100644
> --- a/gcc/ree.c
> +++ b/gcc/ree.c
> @@ -300,7 +300,8 @@ combine_set_extension (ext_cand *cand, rtx curr_insn, rtx *orig_set)
> /* We're going to be widening the result of DEF_INSN, ensure that doing so
> doesn't change the number of hard registers needed for the result. */
> if (HARD_REGNO_NREGS (REGNO (new_reg), cand->mode)
> - != HARD_REGNO_NREGS (REGNO (orig_src), GET_MODE (SET_DEST (*orig_set))))
> + != HARD_REGNO_NREGS (REGNO (SET_DEST (*orig_set)),
> + GET_MODE (SET_DEST (*orig_set))))
Shouldn't that be:
if (HARD_REGNO_NREGS (REGNO (new_reg), cand->mode)
!= HARD_REGNO_NREGS (REGNO (new_reg), GET_MODE (SET_DEST (*orig_set))))
instead?
I mean, for the !copy_needed case it is obviously the same thing (and that
is what triggers in the testcase), but don't we generally want to check if
the same hard register in a wider mode will not occupy more registers, and
in particular the hard register we are considering to use on the lhs of the
defining insn (i.e. new_reg)?
Of course usually HARD_REGNO_NREGS will be the same for the same mode and
different GPR, so it would be really hard to create a testcase.
Jakub