public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 03/11] rtl-ssa: Add entry point to allow re-parenting uses
@ 2023-10-17 20:46 Alex Coplan
  2023-10-18 17:57 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Coplan @ 2023-10-17 20:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Sandiford

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

This is needed by the upcoming aarch64 load pair pass, as it can
re-order stores (when alias analysis determines this is safe) and thus
change which mem def a given use consumes (in the RTL-SSA view, there is
no alias disambiguation of memory).

Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk?

gcc/ChangeLog:

	* rtl-ssa/accesses.cc (function_info::reparent_use): New.
	* rtl-ssa/functions.h (function_info): Declare new member
	function reparent_use.
---
 gcc/rtl-ssa/accesses.cc | 8 ++++++++
 gcc/rtl-ssa/functions.h | 3 +++
 2 files changed, 11 insertions(+)


[-- Attachment #2: 0003-rtl-ssa-Add-entry-point-to-allow-re-parenting-uses.patch --]
[-- Type: text/x-patch, Size: 1159 bytes --]

diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc
index f12b5f4dd77..774ab9d99ee 100644
--- a/gcc/rtl-ssa/accesses.cc
+++ b/gcc/rtl-ssa/accesses.cc
@@ -1239,6 +1239,14 @@ function_info::add_use (use_info *use)
     insert_use_before (use, neighbor->value ());
 }
 
+void
+function_info::reparent_use (use_info *use, set_info *new_def)
+{
+  remove_use (use);
+  use->set_def (new_def);
+  add_use (use);
+}
+
 // If USE has a known definition, remove USE from that definition's list
 // of uses.  Also remove if it from the associated splay tree, if any.
 void
diff --git a/gcc/rtl-ssa/functions.h b/gcc/rtl-ssa/functions.h
index 8b53b264064..d7da9774213 100644
--- a/gcc/rtl-ssa/functions.h
+++ b/gcc/rtl-ssa/functions.h
@@ -159,6 +159,9 @@ public:
   // Like change_insns, but for a single change CHANGE.
   void change_insn (insn_change &change);
 
+  // Given a use USE, re-parent it to get its def from NEW_DEF.
+  void reparent_use (use_info *use, set_info *new_def);
+
   // If the changes that have been made to instructions require updates
   // to the CFG, perform those updates now.  Return true if something changed.
   // If it did:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 03/11] rtl-ssa: Add entry point to allow re-parenting uses
  2023-10-17 20:46 [PATCH 03/11] rtl-ssa: Add entry point to allow re-parenting uses Alex Coplan
@ 2023-10-18 17:57 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-10-18 17:57 UTC (permalink / raw)
  To: Alex Coplan; +Cc: gcc-patches

Alex Coplan <alex.coplan@arm.com> writes:
> This is needed by the upcoming aarch64 load pair pass, as it can
> re-order stores (when alias analysis determines this is safe) and thus
> change which mem def a given use consumes (in the RTL-SSA view, there is
> no alias disambiguation of memory).
>
> Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk?
>
> gcc/ChangeLog:
>
> 	* rtl-ssa/accesses.cc (function_info::reparent_use): New.
> 	* rtl-ssa/functions.h (function_info): Declare new member
> 	function reparent_use.

OK, thanks.

Richard

> ---
>  gcc/rtl-ssa/accesses.cc | 8 ++++++++
>  gcc/rtl-ssa/functions.h | 3 +++
>  2 files changed, 11 insertions(+)
>
> diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc
> index f12b5f4dd77..774ab9d99ee 100644
> --- a/gcc/rtl-ssa/accesses.cc
> +++ b/gcc/rtl-ssa/accesses.cc
> @@ -1239,6 +1239,14 @@ function_info::add_use (use_info *use)
>      insert_use_before (use, neighbor->value ());
>  }
>  
> +void
> +function_info::reparent_use (use_info *use, set_info *new_def)
> +{
> +  remove_use (use);
> +  use->set_def (new_def);
> +  add_use (use);
> +}
> +
>  // If USE has a known definition, remove USE from that definition's list
>  // of uses.  Also remove if it from the associated splay tree, if any.
>  void
> diff --git a/gcc/rtl-ssa/functions.h b/gcc/rtl-ssa/functions.h
> index 8b53b264064..d7da9774213 100644
> --- a/gcc/rtl-ssa/functions.h
> +++ b/gcc/rtl-ssa/functions.h
> @@ -159,6 +159,9 @@ public:
>    // Like change_insns, but for a single change CHANGE.
>    void change_insn (insn_change &change);
>  
> +  // Given a use USE, re-parent it to get its def from NEW_DEF.
> +  void reparent_use (use_info *use, set_info *new_def);
> +
>    // If the changes that have been made to instructions require updates
>    // to the CFG, perform those updates now.  Return true if something changed.
>    // If it did:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-18 17:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 20:46 [PATCH 03/11] rtl-ssa: Add entry point to allow re-parenting uses Alex Coplan
2023-10-18 17:57 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).