From 6b1237e30840dac66ae8d16507581c948c76c52c Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 21 Sep 2017 11:10:48 +0000 Subject: [PATCH] Add copy_rtx call to RTL loop unroller 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 Alan Hayward David Sherwood gcc/ * loop-unroll.c (split_iv): Call copy_rtx on the step. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r253058 --- gcc/ChangeLog | 6 ++++++ gcc/loop-unroll.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8d78c7ad58..7eec76768dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-21 Richard Sandiford + Alan Hayward + David Sherwood + + * loop-unroll.c (split_iv): Call copy_rtx on the step. + 2017-09-21 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 8cf305b24c5..322f151ac5d 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -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); } -- 2.30.2