From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id EB74D3858D38 for ; Thu, 20 Aug 2020 12:10:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB74D3858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=richard.sandiford@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8FF2F30E; Thu, 20 Aug 2020 05:10:19 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 005BC3F66B; Thu, 20 Aug 2020 05:10:18 -0700 (PDT) From: Richard Sandiford To: Senthil Kumar Selvaraj Mail-Followup-To: Senthil Kumar Selvaraj , Senthil Kumar via Gcc-patches , ebotcazou@adacore.com, richard.sandiford@arm.com Cc: Senthil Kumar via Gcc-patches , ebotcazou@adacore.com Subject: Re: [PATCH] emit-rtl.c: Allow splitting of RTX_FRAME_RELATED_P insns? References: <87d03uk7ps.fsf@gcc.gnu.org> Date: Thu, 20 Aug 2020 13:10:17 +0100 In-Reply-To: <87d03uk7ps.fsf@gcc.gnu.org> (Senthil Kumar Selvaraj's message of "Thu, 13 Aug 2020 18:45:27 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 12:10:21 -0000 Sorry for the slow reply. Senthil Kumar Selvaraj writes: > 2020-08-13 Senthil Kumar Selvaraj > > gcc/ChangeLog: > > * emit-rtl.c (try_split): Call copy_frame_info_to_split_insn > to split certain RTX_FRAME_RELATED_P insns. > * recog.c (copy_frame_info_to_split_insn): New function. > (peep2_attempt): Split copying of frame related info of > RTX_FRAME_RELATED_P insns into above function and call it. > * recog.h (copy_frame_info_to_split_insn): Declare it. > > diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c > index f9b0e9714d9..3706f0a03fd 100644 > --- a/gcc/emit-rtl.c > +++ b/gcc/emit-rtl.c > @@ -3822,10 +3822,6 @@ try_split (rtx pat, rtx_insn *trial, int last) > int njumps = 0; > rtx_insn *call_insn = NULL; > > - /* We're not good at redistributing frame information. */ > - if (RTX_FRAME_RELATED_P (trial)) > - return trial; > - > if (any_condjump_p (trial) > && (note = find_reg_note (trial, REG_BR_PROB, 0))) > split_branch_probability > @@ -3842,6 +3838,7 @@ try_split (rtx pat, rtx_insn *trial, int last) > if (!seq) > return trial; > > + int split_insn_count = 0; > /* Avoid infinite loop if any insn of the result matches > the original pattern. */ > insn_last = seq; > @@ -3850,11 +3847,25 @@ try_split (rtx pat, rtx_insn *trial, int last) > if (INSN_P (insn_last) > && rtx_equal_p (PATTERN (insn_last), pat)) > return trial; > + split_insn_count++; > if (!NEXT_INSN (insn_last)) > break; > insn_last = NEXT_INSN (insn_last); > } > > + /* We're not good at redistributing frame information if > + the split occurs before reload or if it results in more > + than one insn. */ > + if (RTX_FRAME_RELATED_P (trial)) > + { > + if (!reload_completed || split_insn_count != 1) > + return trial; > + > + rtx_insn *new_insn = seq; > + rtx_insn *old_insn = trial; > + copy_frame_info_to_split_insn (old_insn, new_insn); > + } > + > /* We will be adding the new sequence to the function. The splitters > may have introduced invalid RTL sharing, so unshare the sequence now. */ > unshare_all_rtl_in_chain (seq); > diff --git a/gcc/recog.c b/gcc/recog.c > index 25f19b1b1cf..e024597f9d7 100644 > --- a/gcc/recog.c > +++ b/gcc/recog.c > @@ -3277,6 +3277,78 @@ peep2_reinit_state (regset live) > COPY_REG_SET (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live); > } > > +/* Copies frame related info of an insn (old_insn) to the single > + insn (new_insn) that was obtained by splitting old_insn. */ By convention, old_insn and new_insn should be in caps, since they refer to parameter names. OK otherwise, thanks. Richard