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.sandif...@linaro.org>
            Alan Hayward  <alan.hayw...@arm.com>
            David Sherwood  <david.sherw...@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);
     }

Reply via email to