[PATCH/MIPS] Fix mips_get_unaligned_mem in some cases

Andrew Pinski pinskia@gmail.com
Sat Jul 21 07:36:00 GMT 2012


Hi,
  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.
-------------- next part --------------
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);
   set_mem_size (*op, width / BITS_PER_UNIT);
 
   /* Get references to both ends of the field.  We deliberately don't


More information about the Gcc-patches mailing list