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 2AD9D3858D1E for ; Fri, 11 Nov 2022 16:19:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2AD9D3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=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 CD1D41FB for ; Fri, 11 Nov 2022 08:20:04 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 44D283F73D for ; Fri, 11 Nov 2022 08:19:58 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH] Handle epilogues that contain jumps Date: Fri, 11 Nov 2022 16:19:57 +0000 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=-42.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP 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: The prologue/epilogue pass allows the prologue sequence to contain jumps. The sequence is then partitioned into basic blocks using find_many_sub_basic_blocks. This patch treats epilogues in the same way. It's needed for a follow-on aarch64 patch that adds conditional code to both the prologue and the epilogue. Tested on aarch64-linux-gnu (including with a follow-on patch) and x86_64-linux-gnu. OK to install? Richard gcc/ * function.cc (thread_prologue_and_epilogue_insns): Handle epilogues that contain jumps. --- gcc/function.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/function.cc b/gcc/function.cc index d3da20ede7f..b54a1d81a3b 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -6136,6 +6136,11 @@ thread_prologue_and_epilogue_insns (void) && returnjump_p (BB_END (e->src))) e->flags &= ~EDGE_FALLTHRU; } + + auto_sbitmap blocks (last_basic_block_for_fn (cfun)); + bitmap_clear (blocks); + bitmap_set_bit (blocks, BLOCK_FOR_INSN (epilogue_seq)->index); + find_many_sub_basic_blocks (blocks); } else if (next_active_insn (BB_END (exit_fallthru_edge->src))) { @@ -6234,6 +6239,11 @@ thread_prologue_and_epilogue_insns (void) set_insn_locations (seq, epilogue_location); emit_insn_before (seq, insn); + + auto_sbitmap blocks (last_basic_block_for_fn (cfun)); + bitmap_clear (blocks); + bitmap_set_bit (blocks, BLOCK_FOR_INSN (insn)->index); + find_many_sub_basic_blocks (blocks); } } -- 2.25.1