From: Richard Sandiford Date: Mon, 1 Jul 2019 08:58:44 +0000 (+0000) Subject: Use ira_setup_alts for conflict detection X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6de20b9d7a1af863fb51b4a783c153ea0092810a;p=gcc.git Use ira_setup_alts for conflict detection make_early_clobber_and_input_conflicts records allocno conflicts between inputs and earlyclobber outputs. It (rightly) avoids doing this for inputs that are explicitly allowed to match the output due to matching constraints. The problem is that whether this matching is allowed varies between alternatives. At the moment the code avoids adding a clobber if *any* enabled alternative allows the match, even if some other operand makes that alternative impossible. The specific instance of this for SVE is that some alternatives allow matched earlyclobbers when a third operand X is constant zero. We should avoid adding conflicts when X really is constant zero, but should ignore the match if X is nonzero or nonconstant. ira_setup_alts can already filter these alternatives out for us, so all we need to do is use it in process_bb_node_lives. The preferred_alternatives variable is only used for this earlyclobber detection, so no other check should be affected. With the previous patch to check the reject weight in ira_setup_alts, this has the effect of ignoring expensive alternatives if we have other valid alternatives with zero cost. It seems reasonable to base the heuristic on only the alternatives that we'd actually like to use, but if this ends up being too aggressive, we could instead make the new reject behaviour conditional and only use it for add_insn_allocno_copies. 2019-07-01 Richard Sandiford gcc/ * ira-lives.c (process_bb_node_lives): Use ira_setup_alts. From-SVN: r272851 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b49bc69045e..489caf1476a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-07-01 Richard Sandiford + + * ira-lives.c (process_bb_node_lives): Use ira_setup_alts. + 2019-07-01 Richard Sandiford * ira.c (ira_get_dup_out_num): Don't punt for earlyclobbers. diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c index 581fdd36aa4..2029027125a 100644 --- a/gcc/ira-lives.c +++ b/gcc/ira-lives.c @@ -80,8 +80,9 @@ static int last_call_num; /* The number of last call at which given allocno was saved. */ static int *allocno_saved_at_call; -/* The value of get_preferred_alternatives for the current instruction, - supplemental to recog_data. */ +/* The value returned by ira_setup_alts for the current instruction; + i.e. the set of alternatives that we should consider to be likely + candidates during reloading. */ static alternative_mask preferred_alternatives; /* If non-NULL, the source operand of a register to register copy for which @@ -1236,9 +1237,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) } } - extract_insn (insn); - preferred_alternatives = get_preferred_alternatives (insn); - preprocess_constraints (insn); + preferred_alternatives = ira_setup_alts (insn); process_single_reg_class_operands (false, freq); if (call_p)