From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 1DBFF3858422 for ; Mon, 31 Jul 2023 10:53:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DBFF3858422 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 53BC922301; Mon, 31 Jul 2023 10:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690800828; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=UE4TpcYN4QK9uR9LJPGVaw8qSaGD5E7AnZYfCmJIpJE=; b=vAAcjTOdUVraJKxYQGF7zZoEOragNdEZsi9CVznHw5v2I22L3s2SPVFDOooFx8g4JqFqXP iC+VDim6XhhTj/Ywp9OmMUMShFTnc3pJXbgQDmwdZGqtGIRgTpk0sprFnvA7vi0EqPZ4Hc VZVh/TN6fj8LF57VcsTMkkyYRxu+PIc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690800828; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=UE4TpcYN4QK9uR9LJPGVaw8qSaGD5E7AnZYfCmJIpJE=; b=Okuk5/VJTMWCs3jlIJUaKZ0spgMqzfKMz3qMEjePGorLkvDWSfKllChkwT7TEaP0v+aRX3 ocxCGh4WkUgZgFBw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3C1AF2C142; Mon, 31 Jul 2023 10:53:48 +0000 (UTC) Date: Mon, 31 Jul 2023 10:53:48 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: vmakarov@redhat.com Subject: Re: [PATCH] rtl-optimization/110587 - remove quadratic regno_in_use_p Message-ID: User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 25 Jul 2023, Richard Biener wrote: > 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. > > Bootstrapped and tested on x86_64-unknown-linux-gnu with > all languages and {,-m32}. > > OK? Ping. > Thanks, > Richard. > > 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. > --- > gcc/lra-spills.cc | 69 +---------------------------------------------- > 1 file changed, 1 insertion(+), 68 deletions(-) > > diff --git a/gcc/lra-spills.cc b/gcc/lra-spills.cc > index 3a7bb7e8cd9..fe58f162d05 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); >