From 355930ab262ceeb4dec0dd1094fd1dee8d9186c6 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 14 Feb 2017 09:44:33 -0700 Subject: [PATCH] re PR target/79404 (h8300: ICE at gcc/ira.c:5541 whilst building libgcc) PR target/79404 * ira-costs.c (scan_one_insn): Initialize register move costs for pseudos seen in USE/CLOBBER insns. From-SVN: r245436 --- gcc/ChangeLog | 4 ++++ gcc/ira-costs.c | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c376aee683..bd6fdb48012 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -4,6 +4,10 @@ 2017-02-14 Jeff Law + PR target/79404 + * ira-costs.c (scan_one_insn): Initialize register move costs + for pseudos seen in USE/CLOBBER insns. + PR tree-optimization/79095 * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the range ~[0,0] make the resultant range ~[0,0]. diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index c561db6a389..17374301456 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1438,9 +1438,25 @@ scan_one_insn (rtx_insn *insn) return insn; pat_code = GET_CODE (PATTERN (insn)); - if (pat_code == USE || pat_code == CLOBBER || pat_code == ASM_INPUT) + if (pat_code == ASM_INPUT) return insn; + /* If INSN is a USE/CLOBBER of a pseudo in a mode M then go ahead + and initialize the register move costs of mode M. + + The pseudo may be related to another pseudo via a copy (implicit or + explicit) and if there are no mode M uses/sets of the original + pseudo, then we may leave the register move costs uninitialized for + mode M. */ + if (pat_code == USE || pat_code == CLOBBER) + { + rtx x = XEXP (PATTERN (insn), 0); + if (GET_CODE (x) == REG + && REGNO (x) >= FIRST_PSEUDO_REGISTER) + ira_init_register_move_cost_if_necessary (GET_MODE (x)); + return insn; + } + counted_mem = false; set = single_set (insn); extract_insn (insn); -- 2.30.2