From bc0423960365b4fc8caebdd5047ea4f993df6e9a Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Thu, 13 Apr 2017 18:08:51 +0000 Subject: [PATCH] re PR rtl-optimization/80343 (ICE in extract_constrain_insn, at recog.c:2213 (error: insn does not satisfy its constraints)) 2017-04-13 Vladimir Makarov PR rtl-optimization/80343 * lra-remat.c (update_scratch_ops): Assign original hard reg to new scratch pseudo. 2017-04-13 Vladimir Makarov PR rtl-optimization/80343 * gcc.target/powerpc/pr80343.c: New. From-SVN: r246914 --- gcc/ChangeLog | 6 +++ gcc/lra-remat.c | 9 ++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.target/powerpc/pr80343.c | 50 ++++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr80343.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2fb6b352231..ca93f9bf21e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-04-13 Vladimir Makarov + + PR rtl-optimization/80343 + * lra-remat.c (update_scratch_ops): Assign original hard reg to + new scratch pseudo. + 2017-04-13 Denis Khalikov PR sanitizer/80414 diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index 5a15075e7aa..2c51481374a 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -1024,6 +1024,7 @@ get_hard_regs (struct lra_insn_reg *reg, int &nregs) static void update_scratch_ops (rtx_insn *remat_insn) { + int hard_regno; lra_insn_recog_data_t id = lra_get_insn_recog_data (remat_insn); struct lra_static_insn_data *static_id = id->insn_static_data; for (int i = 0; i < static_id->n_operands; i++) @@ -1034,9 +1035,17 @@ update_scratch_ops (rtx_insn *remat_insn) int regno = REGNO (*loc); if (! lra_former_scratch_p (regno)) continue; + hard_regno = reg_renumber[regno]; *loc = lra_create_new_reg (GET_MODE (*loc), *loc, lra_get_allocno_class (regno), "scratch pseudo copy"); + if (hard_regno >= 0) + { + reg_renumber[REGNO (*loc)] = hard_regno; + if (lra_dump_file) + fprintf (lra_dump_file, " Assigning the same %d to r%d\n", + REGNO (*loc), hard_regno); + } lra_register_new_scratch_op (remat_insn, i); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c7b8d617364..4f46db8091f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-13 Vladimir Makarov + + PR rtl-optimization/80343 + * gcc.target/powerpc/pr80343.c: New. + 2017-04-13 Denis Khalikov PR sanitizer/80414 diff --git a/gcc/testsuite/gcc.target/powerpc/pr80343.c b/gcc/testsuite/gcc.target/powerpc/pr80343.c new file mode 100644 index 00000000000..cea2a771abb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr80343.c @@ -0,0 +1,50 @@ +/* { dg-do compile { target powerpc-*-*spe } } */ +/* { dg-options "-O2 -ftracer -fPIC" } */ +long long int vi, ls; +int wq, oa, to, fv; +signed char zo; + +long long int +ai (long long int ip, long long int jc, int gt) +{ + ip /= 3; + jc += ip; + if (ip != 0) + vi = 0; + vi += ls; + + if (wq != oa) + { + int tz; + + for (tz = 0; tz < 32; ++tz) + zo -= wq & gt; + + if ((gt & 5) > oa) + { + zo += gt; + fv += zo + to; + } + + if (gt != 0) + oa = 0; + + if (fv != 0) + { + vi += wq; + ls += ip; + jc += (vi != 0) ? ip : ls; + } + + while (tz != 0) + { + zo = wq; + tz = zo; + } + + ++to; + wq = ip; + } + + return jc; +} -- 2.30.2