https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179
--- Comment #19 from Peter Bergner <bergner at gcc dot gnu.org> --- (In reply to Peter Bergner from comment #18) > (In reply to Jakub Jelinek from comment #16) > > Can't you move all the tests that don't need id or static_id (all but one) > > before the > > lra_insn_recog_data_t id = lra_get_insn_recog_data (to); > > struct lra_static_insn_data *static_id = id->insn_static_data; > > instead? > > Ok, single_set is also a call, so maybe keep that one too? > > > > I know, microoptimizations... > > Looking at lra_get_insn_recog_data() versus the common case for > single_set(), I think moving the single_set() call earlier is fine too, and > it simplifies the final code with just the one early out tests rather than > splitting them up. Ah, nevermind, we have the "|| id->used_insn_alternative == LRA_UNKNOWN_ALT" which we can't move. Then I'll keep the single_set() close to it's use of the result just after. How about this? --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -5014,14 +5014,19 @@ combine_reload_insn (rtx_insn *from, rtx_insn *to) enum reg_class to_class, from_class; int n, nop; signed char changed_nops[MAX_RECOG_OPERANDS + 1]; - lra_insn_recog_data_t id = lra_get_insn_recog_data (to); - struct lra_static_insn_data *static_id = id->insn_static_data; /* Check conditions for second memory reload and original insn: */ if ((targetm.secondary_memory_needed == hook_bool_mode_reg_class_t_reg_class_t_false) - || NEXT_INSN (from) != to || CALL_P (to) - || id->used_insn_alternative == LRA_UNKNOWN_ALT + || NEXT_INSN (from) != to + || !NONDEBUG_INSN_P (to) + || CALL_P (to)) + return false; + + lra_insn_recog_data_t id = lra_get_insn_recog_data (to); + struct lra_static_insn_data *static_id = id->insn_static_data; + + if (id->used_insn_alternative == LRA_UNKNOWN_ALT || (set = single_set (from)) == NULL_RTX) return false; from_reg = SET_DEST (set);