aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-07-25 15:32:11 +0200
committerRichard Biener <rguenther@suse.de>2023-08-02 09:03:13 +0200
commit07b7cd70399d22c113ad8bb1eff5cc2d12973d33 (patch)
treea0eeb793d4e83846abcc29be91a9066da7304d09
parentf0b7a61d83534fc8f7aa593b1f0f0357a371a800 (diff)
downloadgcc-07b7cd70399d22c113ad8bb1eff5cc2d12973d33.zip
gcc-07b7cd70399d22c113ad8bb1eff5cc2d12973d33.tar.gz
gcc-07b7cd70399d22c113ad8bb1eff5cc2d12973d33.tar.bz2
rtl-optimization/110587 - remove quadratic regno_in_use_p
The following removes the code checking whether a noop copy is between something involved in the return sequence composed of a SET and USE. Instead of checking for this special-case the following makes us only ever remove noop copies between pseudos - which is the case that is necessary for IRA/LRA interfacing to function according to the comment. That makes looking for the return reg special case unnecessary, reducing the compile-time in LRA non-specific to zero for the testcase. PR rtl-optimization/110587 * lra-spills.cc (return_regno_p): Remove. (regno_in_use_p): Likewise. (lra_final_code_change): Do not remove noop moves between hard registers.
-rw-r--r--gcc/lra-spills.cc69
1 files changed, 1 insertions, 68 deletions
diff --git a/gcc/lra-spills.cc b/gcc/lra-spills.cc
index 3a7bb7e..fe58f16 100644
--- a/gcc/lra-spills.cc
+++ b/gcc/lra-spills.cc
@@ -705,72 +705,6 @@ alter_subregs (rtx *loc, bool final_p)
return res;
}
-/* Return true if REGNO is used for return in the current
- function. */
-static bool
-return_regno_p (unsigned int regno)
-{
- rtx outgoing = crtl->return_rtx;
-
- if (! outgoing)
- return false;
-
- if (REG_P (outgoing))
- return REGNO (outgoing) == regno;
- else if (GET_CODE (outgoing) == PARALLEL)
- {
- int i;
-
- for (i = 0; i < XVECLEN (outgoing, 0); i++)
- {
- rtx x = XEXP (XVECEXP (outgoing, 0, i), 0);
-
- if (REG_P (x) && REGNO (x) == regno)
- return true;
- }
- }
- return false;
-}
-
-/* Return true if REGNO is in one of subsequent USE after INSN in the
- same BB. */
-static bool
-regno_in_use_p (rtx_insn *insn, unsigned int regno)
-{
- static lra_insn_recog_data_t id;
- static struct lra_static_insn_data *static_id;
- struct lra_insn_reg *reg;
- int i, arg_regno;
- basic_block bb = BLOCK_FOR_INSN (insn);
-
- while ((insn = next_nondebug_insn (insn)) != NULL_RTX)
- {
- if (BARRIER_P (insn) || bb != BLOCK_FOR_INSN (insn))
- return false;
- if (! INSN_P (insn))
- continue;
- if (GET_CODE (PATTERN (insn)) == USE
- && REG_P (XEXP (PATTERN (insn), 0))
- && regno == REGNO (XEXP (PATTERN (insn), 0)))
- return true;
- /* Check that the regno is not modified. */
- id = lra_get_insn_recog_data (insn);
- for (reg = id->regs; reg != NULL; reg = reg->next)
- if (reg->type != OP_IN && reg->regno == (int) regno)
- return false;
- static_id = id->insn_static_data;
- for (reg = static_id->hard_regs; reg != NULL; reg = reg->next)
- if (reg->type != OP_IN && reg->regno == (int) regno)
- return false;
- if (id->arg_hard_regs != NULL)
- for (i = 0; (arg_regno = id->arg_hard_regs[i]) >= 0; i++)
- if ((int) regno == (arg_regno >= FIRST_PSEUDO_REGISTER
- ? arg_regno : arg_regno - FIRST_PSEUDO_REGISTER))
- return false;
- }
- return false;
-}
-
/* Final change of pseudos got hard registers into the corresponding
hard registers and removing temporary clobbers. */
void
@@ -821,8 +755,7 @@ lra_final_code_change (void)
if (NONJUMP_INSN_P (insn) && GET_CODE (pat) == SET
&& REG_P (SET_SRC (pat)) && REG_P (SET_DEST (pat))
&& REGNO (SET_SRC (pat)) == REGNO (SET_DEST (pat))
- && (! return_regno_p (REGNO (SET_SRC (pat)))
- || ! regno_in_use_p (insn, REGNO (SET_SRC (pat)))))
+ && REGNO (SET_SRC (pat)) >= FIRST_PSEUDO_REGISTER)
{
lra_invalidate_insn_data (insn);
delete_insn (insn);