From: Uros Bizjak Date: Thu, 24 Jan 2019 20:48:01 +0000 (+0100) Subject: re PR rtl-optimization/88948 (ICE in elimination_costs_in_insn, at reload1.c:3640... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53f2f08b057b6b57b5d8b99db10b63de0634715c;p=gcc.git re PR rtl-optimization/88948 (ICE in elimination_costs_in_insn, at reload1.c:3640 since r264148) PR target/88948 * rtl.h (prepare_copy_insn): New prototype. * gcse.c (prepare_copy_insn): New function, split out from process_insert_insn. (process_insert_insn): Use prepare_copy_insn. * store-motion.c (replace_store_insn): Use prepare_copy_insn instead of gen_move_insn. testsuite/ChangeLog: PR target/88948 * gcc.target/i386/pr88948.c: New test. From-SVN: r268249 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b797550ba7..915d32ef0ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-01-24 Uroš Bizjak + + PR target/88948 + * rtl.h (prepare_copy_insn): New prototype. + * gcse.c (prepare_copy_insn): New function, split out from + process_insert_insn. + (process_insert_insn): Use prepare_copy_insn. + * store-motion.c (replace_store_insn): Use prepare_copy_insn + instead of gen_move_insn. + 2019-01-24 Jakub Jelinek PR debug/89006 diff --git a/gcc/gcse.c b/gcc/gcse.c index 35716cd3883..6c77671fe31 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1963,14 +1963,11 @@ pre_expr_reaches_here_p (basic_block occr_bb, struct gcse_expr *expr, basic_bloc return rval; } -/* Generate RTL to copy an EXPR to its `reaching_reg' and return it. */ +/* Generate RTL to copy an EXP to REG and return it. */ -static rtx_insn * -process_insert_insn (struct gcse_expr *expr) +rtx_insn * +prepare_copy_insn (rtx reg, rtx exp) { - rtx reg = expr->reaching_reg; - /* Copy the expression to make sure we don't have any sharing issues. */ - rtx exp = copy_rtx (expr->expr); rtx_insn *pat; start_sequence (); @@ -1996,6 +1993,18 @@ process_insert_insn (struct gcse_expr *expr) return pat; } +/* Generate RTL to copy an EXPR to its `reaching_reg' and return it. */ + +static rtx_insn * +process_insert_insn (struct gcse_expr *expr) +{ + rtx reg = expr->reaching_reg; + /* Copy the expression to make sure we don't have any sharing issues. */ + rtx exp = copy_rtx (expr->expr); + + return prepare_copy_insn (reg, exp); +} + /* Add EXPR to the end of basic block BB. This is used by both the PRE and code hoisting. */ diff --git a/gcc/rtl.h b/gcc/rtl.h index 70891e6e364..f99191983d3 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -4078,6 +4078,9 @@ extern void init_lower_subreg (void); /* In gcse.c */ extern bool can_copy_p (machine_mode); extern bool can_assign_to_reg_without_clobbers_p (rtx, machine_mode); +extern rtx_insn *prepare_copy_insn (rtx, rtx); + +/* In cprop.c */ extern rtx fis_get_condition (rtx_insn *); /* In ira.c */ diff --git a/gcc/store-motion.c b/gcc/store-motion.c index 28c4825b343..a0838f68ba0 100644 --- a/gcc/store-motion.c +++ b/gcc/store-motion.c @@ -912,8 +912,7 @@ replace_store_insn (rtx reg, rtx_insn *del, basic_block bb, rtx_insn *insn; rtx mem, note, set; - mem = smexpr->pattern; - insn = gen_move_insn (reg, SET_SRC (single_set (del))); + insn = prepare_copy_insn (reg, SET_SRC (single_set (del))); unsigned int i; rtx_insn *temp; @@ -946,6 +945,7 @@ replace_store_insn (rtx reg, rtx_insn *del, basic_block bb, /* Now we must handle REG_EQUAL notes whose contents is equal to the mem; they are no longer accurate provided that they are reached by this definition, so drop them. */ + mem = smexpr->pattern; for (; insn != NEXT_INSN (BB_END (bb)); insn = NEXT_INSN (insn)) if (NONDEBUG_INSN_P (insn)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 285c69971c7..e7ac88c3ca0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-24 Uroš Bizjak + + PR target/88948 + * gcc.target/i386/pr88948.c: New test. + 2019-01-24 Jakub Jelinek PR debug/89006 diff --git a/gcc/testsuite/gcc.target/i386/pr88948.c b/gcc/testsuite/gcc.target/i386/pr88948.c new file mode 100644 index 00000000000..5b50803b60b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr88948.c @@ -0,0 +1,5 @@ +/* PR rtl-optimization/88948 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fgcse-sm -msse3 -mfpmath=387" } */ + +#include "../../gcc.c-torture/execute/stdarg-3.c"