Add copy_rtx call to RTL loop unroller

Richard Sandiford richard.sandiford@linaro.org
Wed Sep 20 12:27:00 GMT 2017


This is needed if the step is an unshared constant, like many
(const ...)s are.  Without this patch, libgfortran would fail
to build for SVE.

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linus-gnu.
OK to install?

Richard


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

gcc/
	* loop-unroll.c (split_iv): Call copy_rtx on the step.

Index: gcc/loop-unroll.c
===================================================================
--- gcc/loop-unroll.c	2017-08-30 12:13:52.715828832 +0100
+++ gcc/loop-unroll.c	2017-09-20 13:26:14.451718893 +0100
@@ -1731,7 +1731,8 @@ split_iv (struct iv_to_split *ivts, rtx_
   else
     {
       incr = simplify_gen_binary (MULT, mode,
-				  ivts->step, gen_int_mode (delta, mode));
+				  copy_rtx (ivts->step),
+				  gen_int_mode (delta, mode));
       expr = simplify_gen_binary (PLUS, GET_MODE (ivts->base_var),
 				  ivts->base_var, incr);
     }



More information about the Gcc-patches mailing list