From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id E99E73858D28 for ; Tue, 22 Aug 2023 11:04:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E99E73858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2b703a0453fso73134171fa.3 for ; Tue, 22 Aug 2023 04:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692702295; x=1693307095; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jV6GVt5mEKZdRnedwi5nBoptmr0y4kr8xAfl8VRMO7w=; b=DgGpFWEqVe+Z6AD9PzjUmZbk5F9nKxDN1ZCjLX7dSjIaltxolTjDbQnOR7fngFUtyJ w0/ySiNZh7aWLT4MeTUL47VwdYT7PAV8a3iv5HMLtjZqhKN6Ywmckc5mQhBbgGcLpKWY omFnXf+4ruHv4rE0nipEjyfh3sxHycbQedKGw6OOIGzJhDC6LEn9SJCX/yfPwGt3wHqW tZGZcercLIsN3uuGWc+gep68yOFUK2QK72ZvndolTUjVymvnyBxlK043O74NDLttAS/4 KDFAsxN1TckBEpZikUNloAM0TaCX2BlVc8wcPbKjGqXX2RPZ0zny9RXJF7dqgpWnGbhL /Ofg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692702295; x=1693307095; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jV6GVt5mEKZdRnedwi5nBoptmr0y4kr8xAfl8VRMO7w=; b=DCYgj6a1HptQYucDtQtN0yY0Xhijp7xINy8918A9Txn8DkjwV+kw5jOvWo1dwE5nE6 aWCtUTRqC/Q7xveeZ4cyAT3ouZB04+cCHaVlQrcB65tELuwam9hpBm1pjfKcH6BkkeI/ EFWMMNcFoGE29I5O2vVhDbVG/hYC0B67On3HPgNyFCIOvl636QrfzWDmVw7Vmzm2ddGA Q0wfMeSuFgwiN0Sug8m1nrPTFR69tvsoKJkyFqqXwniZhxKEYLWkLtSky3vREx6rxSys qXwbuyrSKQrTeGy2llr706q7wqhpVoAGDOGVyzLO2MKubBhrq4lgIIYmCkO9npCVEJ2w RGnQ== X-Gm-Message-State: AOJu0Yzx3teag7wdkEju3E5Xfp8Qs7daOI3PQ1vBRMll8+HknMEhgFMj kfc1kytDiaiVI0MJy2y13saQBvVDVVXIIZfkM5s= X-Google-Smtp-Source: AGHT+IF0X06iCYU3r25jpme11/OUEPD6WB9ynn5NWOaldWomhjmc1bGyljG3fAmNwnlE5x17hc/rGCNqB2nsa4spVYk= X-Received: by 2002:a2e:7007:0:b0:2bc:d6a8:1efd with SMTP id l7-20020a2e7007000000b002bcd6a81efdmr174071ljc.39.1692702295153; Tue, 22 Aug 2023 04:04:55 -0700 (PDT) MIME-Version: 1.0 References: <103b7db0ce64fb9f2757e1a7d98cb7fa3103c4f2.1692699125.git.szabolcs.nagy@arm.com> In-Reply-To: <103b7db0ce64fb9f2757e1a7d98cb7fa3103c4f2.1692699125.git.szabolcs.nagy@arm.com> From: Richard Biener Date: Tue, 22 Aug 2023 13:03:26 +0200 Message-ID: Subject: Re: [PATCH 02/11] Handle epilogues that contain jumps To: Szabolcs Nagy Cc: gcc-patches@gcc.gnu.org, Kyrylo.Tkachov@arm.com, richard.earnshaw@arm.com, richard.sandiford@arm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On Tue, Aug 22, 2023 at 12:42=E2=80=AFPM Szabolcs Nagy via Gcc-patches wrote: > > From: Richard Sandiford > > 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. > --- > > This is a previously approved patch that was not committed > because it was not needed at the time, but i'd like to commit > it as it is needed for the followup aarch64 eh_return changes: > > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605769.html > > --- > gcc/function.cc | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gcc/function.cc b/gcc/function.cc > index dd2c1136e07..70d1cd65303 100644 > --- a/gcc/function.cc > +++ b/gcc/function.cc > @@ -6120,6 +6120,11 @@ thread_prologue_and_epilogue_insns (void) > && returnjump_p (BB_END (e->src))) > e->flags &=3D ~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))) > { > @@ -6218,6 +6223,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); I'll note that clearing a full sbitmap to pass down a single basic block to find_many_sub_basic_blocks is a quite expensive operation. May I sugges= t to add an overload operating on a single basic block? It's only FOR_EACH_BB_FN (bb, cfun) SET_STATE (bb, bitmap_bit_p (blocks, bb->index) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL); using the bitmap, so factoring the rest of the function and customizing thi= s walk would do the trick. Note that the whole function could be refactored = to handle single blocks more efficiently. > } > } > > -- > 2.25.1 >