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 6AF9C3858412 for ; Mon, 22 Jan 2024 16:12:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AF9C3858412 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AF9C3858412 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705939943; cv=none; b=ehn2QdJlFgwj23K/21ckEGRMEfGeHEwpU55G2MwaG5lOrGdTVyPNorHK03YOB150I7ouWLeRuW+PCHtYRwdKT+9k/W5voJL2eXoAcWb1YNLq2Rm4NWJyR3py903fZfohMqhVUjK+htMr1z/ni6SoVnLFLjntQ8kdhmpLvsjVYbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705939943; c=relaxed/simple; bh=o++XfV+Fq8Y9qyQd0aOK8hxYuPvuPxqXRNP110YdvyU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=e3r3A6/l+tj5ylUsVO0x+VPBpYCxmrk0skZnx5iv4V3ZjZ5ZCeq1B0APldAksiEGKAonKiMLPlWpxW6P+j2ORzmx6UV2PPjtrW06YJjvp8Ed4USMEXP+/o0Bx8TY9Z/BMsCT+1DHOY5wkLVmjVv8FoxNWSfCqVr3fHfMrUOZsWs= ARC-Authentication-Results: i=1; server2.sourceware.org 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 D78B91FB; Mon, 22 Jan 2024 08:13:03 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 150FE3F5A1; Mon, 22 Jan 2024 08:12:16 -0800 (PST) From: Richard Sandiford To: Alex Coplan Mail-Followup-To: Alex Coplan ,gcc-patches@gcc.gnu.org, Kyrylo Tkachov , Richard Earnshaw , richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, Kyrylo Tkachov , Richard Earnshaw Subject: Re: [PATCH 1/3] rtl-ssa: Provide easier access to debug uses [PR113089] References: Date: Mon, 22 Jan 2024 16:12:15 +0000 In-Reply-To: (Alex Coplan's message of "Fri, 19 Jan 2024 09:04:20 +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=-21.4 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,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: Alex Coplan writes: > This patch adds some accessors to set_info and use_info to make it > easier to get at and iterate through uses in debug insns. > > It is used by the aarch64 load/store pair fusion pass in a subsequent > patch to fix PR113089, i.e. to update debug uses in the pass. > > Bootstrapped/regtested as a series on aarch64-linux-gnu (with/without > the load/store pair pass enabled), OK for trunk? > > gcc/ChangeLog: > > PR target/113089 > * rtl-ssa/accesses.h (use_info::next_debug_insn_use): New. > (debug_insn_use_iterator): New. > (set_info::first_debug_insn_use): New. > (set_info::debug_insn_uses): New. > * rtl-ssa/member-fns.inl (use_info::next_debug_insn_use): New. > (set_info::first_debug_insn_use): New. > (set_info::debug_insn_uses): New. OK, thanks. Richard > --- > gcc/rtl-ssa/accesses.h | 13 +++++++++++++ > gcc/rtl-ssa/member-fns.inl | 29 +++++++++++++++++++++++++++++ > 2 files changed, 42 insertions(+) > > diff --git a/gcc/rtl-ssa/accesses.h b/gcc/rtl-ssa/accesses.h > index 6a3ecd32848..c57b8a8b7b5 100644 > --- a/gcc/rtl-ssa/accesses.h > +++ b/gcc/rtl-ssa/accesses.h > @@ -357,6 +357,10 @@ public: > // next_use () && next_use ()->is_in_any_insn () ? next_use () : nullptr > use_info *next_any_insn_use () const; > > + // Return the next use by a debug instruction, or null if none. > + // This is only valid if if is_in_debug_insn (). > + use_info *next_debug_insn_use () const; > + > // Return the previous use by a phi node in the list, or null if none. > // > // This is only valid if is_in_phi (). It is equivalent to: > @@ -458,6 +462,8 @@ using reverse_use_iterator = list_iterator; > // of use in the same definition. > using nondebug_insn_use_iterator > = list_iterator; > +using debug_insn_use_iterator > + = list_iterator; > using any_insn_use_iterator > = list_iterator; > using phi_use_iterator = list_iterator; > @@ -680,6 +686,10 @@ public: > use_info *first_nondebug_insn_use () const; > use_info *last_nondebug_insn_use () const; > > + // Return the first use of the set by debug instructions, or null if > + // there is no such use. > + use_info *first_debug_insn_use () const; > + > // Return the first use of the set by any kind of instruction, or null > // if there are no such uses. The uses are in the order described above. > use_info *first_any_insn_use () const; > @@ -731,6 +741,9 @@ public: > // List the uses of the set by nondebug instructions, in reverse postorder. > iterator_range nondebug_insn_uses () const; > > + // List the uses of the set by debug instructions, in reverse postorder. > + iterator_range debug_insn_uses () const; > + > // Return nondebug_insn_uses () in reverse order. > iterator_range reverse_nondebug_insn_uses () const; > > diff --git a/gcc/rtl-ssa/member-fns.inl b/gcc/rtl-ssa/member-fns.inl > index 8e1c17ced95..e4825ad2a18 100644 > --- a/gcc/rtl-ssa/member-fns.inl > +++ b/gcc/rtl-ssa/member-fns.inl > @@ -119,6 +119,15 @@ use_info::next_any_insn_use () const > return nullptr; > } > > +inline use_info * > +use_info::next_debug_insn_use () const > +{ > + if (auto use = next_use ()) > + if (use->is_in_debug_insn ()) > + return use; > + return nullptr; > +} > + > inline use_info * > use_info::prev_phi_use () const > { > @@ -212,6 +221,20 @@ set_info::last_nondebug_insn_use () const > return nullptr; > } > > +inline use_info * > +set_info::first_debug_insn_use () const > +{ > + use_info *use; > + if (has_nondebug_insn_uses ()) > + use = last_nondebug_insn_use ()->next_use (); > + else > + use = first_use (); > + > + if (use && use->is_in_debug_insn ()) > + return use; > + return nullptr; > +} > + > inline use_info * > set_info::first_any_insn_use () const > { > @@ -310,6 +333,12 @@ set_info::nondebug_insn_uses () const > return { first_nondebug_insn_use (), nullptr }; > } > > +inline iterator_range > +set_info::debug_insn_uses () const > +{ > + return { first_debug_insn_use (), nullptr }; > +} > + > inline iterator_range > set_info::reverse_nondebug_insn_uses () const > {