diff mbox series

[093/nnn] poly_int: adjust_mems

Message ID 87mv4hepex.fsf@linaro.org
State New
Headers show
Series [093/nnn] poly_int: adjust_mems | expand

Commit Message

Richard Sandiford Oct. 23, 2017, 5:37 p.m. UTC
This patch makes the var-tracking.c handling of autoinc addresses
cope with polynomial mode sizes.


2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
	Use plus_constant instead of gen_rtx_PLUS.

Comments

Jeff Law Nov. 28, 2017, 8:30 a.m. UTC | #1
On 10/23/2017 11:37 AM, Richard Sandiford wrote:
> This patch makes the var-tracking.c handling of autoinc addresses
> cope with polynomial mode sizes.
> 
> 
> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
> 	Use plus_constant instead of gen_rtx_PLUS.
OK.
jeff
diff mbox series

Patch

Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	2017-10-23 17:16:59.708267276 +0100
+++ gcc/var-tracking.c	2017-10-23 17:25:40.610779914 +0100
@@ -1016,6 +1016,7 @@  adjust_mems (rtx loc, const_rtx old_rtx,
   machine_mode mem_mode_save;
   bool store_save;
   scalar_int_mode tem_mode, tem_subreg_mode;
+  poly_int64 size;
   switch (GET_CODE (loc))
     {
     case REG:
@@ -1060,11 +1061,9 @@  adjust_mems (rtx loc, const_rtx old_rtx,
       return mem;
     case PRE_INC:
     case PRE_DEC:
-      addr = gen_rtx_PLUS (GET_MODE (loc), XEXP (loc, 0),
-			   gen_int_mode (GET_CODE (loc) == PRE_INC
-					 ? GET_MODE_SIZE (amd->mem_mode)
-					 : -GET_MODE_SIZE (amd->mem_mode),
-					 GET_MODE (loc)));
+      size = GET_MODE_SIZE (amd->mem_mode);
+      addr = plus_constant (GET_MODE (loc), XEXP (loc, 0),
+			    GET_CODE (loc) == PRE_INC ? size : -size);
       /* FALLTHRU */
     case POST_INC:
     case POST_DEC:
@@ -1072,12 +1071,10 @@  adjust_mems (rtx loc, const_rtx old_rtx,
 	addr = XEXP (loc, 0);
       gcc_assert (amd->mem_mode != VOIDmode && amd->mem_mode != BLKmode);
       addr = simplify_replace_fn_rtx (addr, old_rtx, adjust_mems, data);
-      tem = gen_rtx_PLUS (GET_MODE (loc), XEXP (loc, 0),
-			  gen_int_mode ((GET_CODE (loc) == PRE_INC
-					 || GET_CODE (loc) == POST_INC)
-					? GET_MODE_SIZE (amd->mem_mode)
-					: -GET_MODE_SIZE (amd->mem_mode),
-					GET_MODE (loc)));
+      size = GET_MODE_SIZE (amd->mem_mode);
+      tem = plus_constant (GET_MODE (loc), XEXP (loc, 0),
+			   (GET_CODE (loc) == PRE_INC
+			    || GET_CODE (loc) == POST_INC) ? size : -size);
       store_save = amd->store;
       amd->store = false;
       tem = simplify_replace_fn_rtx (tem, old_rtx, adjust_mems, data);