The following patch is for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89865
The patch was successfully tested on x86-64, aarch64, and ppc64.
The patch decreases scan matches from 82 to 8 on x86-64. I don't know
what test pr49095.c should expect. Therefore I don't change the test
itself.
Committed as rev. 270060
Index: ChangeLog
===================================================================
--- ChangeLog (revision 270059)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2019-04-01 Vladimir Makarov <vmaka...@redhat.com>
+
+ PR rtl-optimization/89865
+ * ira-costs.c (process_bb_node_for_hard_reg_moves): Skip hard
+ register if it is a part of small class.
+
2019-04-01 Andrey Belevantsev <a...@ispras.ru>
PR rtl-optimization/87273
Index: ira-costs.c
===================================================================
--- ira-costs.c (revision 270004)
+++ ira-costs.c (working copy)
@@ -2107,6 +2107,13 @@ process_bb_node_for_hard_reg_moves (ira_
}
else
continue;
+ if (reg_class_size[(int) REGNO_REG_CLASS (hard_regno)]
+ == (ira_reg_class_max_nregs
+ [REGNO_REG_CLASS (hard_regno)][(int) ALLOCNO_MODE(a)]))
+ /* If the class can provide only one hard reg to the allocno,
+ we processed the insn record_operand_costs already and we
+ actually updated the hard reg cost there. */
+ continue;
rclass = ALLOCNO_CLASS (a);
if (! TEST_HARD_REG_BIT (reg_class_contents[rclass], hard_regno))
continue;