This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/MIPS] Fix mips_get_unaligned_mem in some cases
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 21 Jul 2012 09:15:01 +0100
- Subject: Re: [PATCH/MIPS] Fix mips_get_unaligned_mem in some cases
- References: <CA+=Sn1myL8rx7Gsu8BfgytJ-2iQDQS3+WUuSgLvq136o9qwNMg@mail.gmail.com>
Andrew Pinski <pinskia@gmail.com> writes:
> The problem here is that adjust_address returns the same rtl as we
> already have a BLKmode; mips_block_move_straight pass a BLKmode MEM to
> mips_expand_ext_as_unaligned_load.
> The following patch fixes the problem by copying the MEM after calling
> adjust_address. This does increase garbage slightly but not enough to
> take a notice. I could only get this to expose after improving
> mips_block_move_straight but it could show up in otherwise. The
> testcase where it showed has already been committed as
> testsuite/gcc.c-torture/compile/20120524-1.c .
>
> OK? Bootstrapped and tested on mips64-linux-gnu with no regressions.
>
> ChangeLog:
> * config/mips/mips.c (mips_get_unaligned_mem): Copy *op after calling
> adjust_address.
>
> Index: config/mips/mips.c
> ===================================================================
> --- config/mips/mips.c (revision 189542)
> +++ config/mips/mips.c (working copy)
> @@ -7220,6 +7220,8 @@ mips_get_unaligned_mem (rtx *op, HOST_WI
> /* Adjust *OP to refer to the whole field. This also has the effect
> of legitimizing *OP's address for BLKmode, possibly simplifying it. */
> *op = adjust_address (*op, BLKmode, 0);
> + /* Copy the RTX as adjust_address might return the original rtl. */
> + *op = copy_rtx (*op);
Sorry to be so picky, but I'd prefer:
/* Create a copy of *OP that refers to the whole field. This also has
the effect of legitimizing *OP's address for BLKmode, possibly
simplifying it. */
*op = copy_rtx (adjust_address (*op, BLKmode, 0));
OK with that change, thanks.
Richard