Add copy_rtx call to RTL loop unroller
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 21 Sep 2017 11:10:48 +0000 (11:10 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 21 Sep 2017 11:10:48 +0000 (11:10 +0000)
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.

2017-09-21  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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r253058

gcc/ChangeLog
gcc/loop-unroll.c

index a8d78c7ad58aeda897e17efe01c851281bdc2b55..7eec76768dd886a7deb6dabcffee46d33fbe55df 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-21  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * loop-unroll.c (split_iv): Call copy_rtx on the step.
+
 2017-09-21  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index 8cf305b24c59aa27a0db4c39cbeaa6e98795c8f9..322f151ac5dfdc4f0303ee73ad8220fc694f30e8 100644 (file)
@@ -1731,7 +1731,8 @@ split_iv (struct iv_to_split *ivts, rtx_insn *insn, unsigned delta)
   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);
     }