public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] pair-fusion: fix for older GCC
@ 2024-06-03  7:57 Marc Poulhiès
  2024-06-03  8:08 ` Richard Sandiford
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Poulhiès @ 2024-06-03  7:57 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ajit Agarwal, Richard Sandiford, Marc Poulhiès

Older GCCs fail with:

  .../gcc/pair-fusion.cc: In member function ‘bool pair_fusion_bb_info::fuse_pair(bool, unsigned int, int, rtl_ssa::insn_info*, rtl_ssa::in
  sn_info*, base_cand&, const rtl_ssa::insn_range_info&)’:
  .../gcc/pair-fusion.cc:1790:40: error: ‘writeback’ is not a class, namespace, or enumeration
     if (m_pass->should_handle_writeback (writeback::ALL)

Renaming the enum type works around the name conflict with the local
variable and also prevents future similar conflicts.

gcc/ChangeLog:

	* pair-fusion.h (enum class writeback): Rename to...
	(enum class writeback_type): ...this.
	(struct pair_fusion): Adjust type name after renaming.
	* pair-fusion.cc (pair_fusion_bb_info::track_access): Likewise.
	(pair_fusion_bb_info::fuse_pair): Likewise.
	(pair_fusion::process_block): Likewise.
---
Patch discussed in https://inbox.sourceware.org/gcc-patches/mptwmn93njq.fsf@arm.com/

Tested on x86_64-linux-gnu. OK for master?

 gcc/pair-fusion.cc | 6 +++---
 gcc/pair-fusion.h  | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/pair-fusion.cc b/gcc/pair-fusion.cc
index 9f897ac04e2..26b2284ed37 100644
--- a/gcc/pair-fusion.cc
+++ b/gcc/pair-fusion.cc
@@ -426,7 +426,7 @@ pair_fusion_bb_info::track_access (insn_info *insn, bool load_p, rtx mem)
     return;
 
   // Ignore writeback accesses if the hook says to do so.
-  if (!m_pass->should_handle_writeback (writeback::EXISTING)
+  if (!m_pass->should_handle_writeback (writeback_type::EXISTING)
       && GET_RTX_CLASS (GET_CODE (XEXP (mem, 0))) == RTX_AUTOINC)
     return;
 
@@ -1787,7 +1787,7 @@ pair_fusion_bb_info::fuse_pair (bool load_p,
   // update of the base register and try and fold it in to make this into a
   // writeback pair.
   insn_info *trailing_add = nullptr;
-  if (m_pass->should_handle_writeback (writeback::ALL)
+  if (m_pass->should_handle_writeback (writeback_type::ALL)
       && !writeback_effect
       && (!load_p || (!refers_to_regno_p (base_regno, base_regno + 1,
 					 XEXP (pats[0], 0), nullptr)
@@ -2996,7 +2996,7 @@ void pair_fusion::process_block (bb_info *bb)
       rtx pat = PATTERN (rti);
       bool load_p;
       if (reload_completed
-	  && should_handle_writeback (writeback::ALL)
+	  && should_handle_writeback (writeback_type::ALL)
 	  && pair_mem_insn_p (rti, load_p))
 	try_promote_writeback (insn, load_p);
 
diff --git a/gcc/pair-fusion.h b/gcc/pair-fusion.h
index 2a38dc8f743..45e4edceecb 100644
--- a/gcc/pair-fusion.h
+++ b/gcc/pair-fusion.h
@@ -75,7 +75,7 @@ struct alias_walker;
 
 // When querying should_handle_writeback, this enum is used to
 // qualify which opportunities we are asking about.
-enum class writeback {
+enum class writeback_type {
   // Only those writeback opportunities that arise from existing
   // auto-increment accesses.
   EXISTING,
@@ -123,7 +123,7 @@ struct pair_fusion {
   // Return true if we should try to handle writeback opportunities.
   // WHICH determines the kinds of writeback opportunities the caller
   // is asking about.
-  virtual bool should_handle_writeback (enum writeback which) = 0;
+  virtual bool should_handle_writeback (writeback_type which) = 0;
 
   // Given BASE_MEM, the mem from the lower candidate access for a pair,
   // and LOAD_P (true if the access is a load), check if we should proceed
-- 
2.45.1


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

* Re: [PATCH] pair-fusion: fix for older GCC
  2024-06-03  7:57 [PATCH] pair-fusion: fix for older GCC Marc Poulhiès
@ 2024-06-03  8:08 ` Richard Sandiford
  2024-06-03  9:21   ` Marc Poulhiès
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2024-06-03  8:08 UTC (permalink / raw)
  To: Marc Poulhiès; +Cc: gcc-patches, Ajit Agarwal

Marc Poulhiès <poulhies@adacore.com> writes:
> Older GCCs fail with:
>
>   .../gcc/pair-fusion.cc: In member function ‘bool pair_fusion_bb_info::fuse_pair(bool, unsigned int, int, rtl_ssa::insn_info*, rtl_ssa::in
>   sn_info*, base_cand&, const rtl_ssa::insn_range_info&)’:
>   .../gcc/pair-fusion.cc:1790:40: error: ‘writeback’ is not a class, namespace, or enumeration
>      if (m_pass->should_handle_writeback (writeback::ALL)
>
> Renaming the enum type works around the name conflict with the local
> variable and also prevents future similar conflicts.
>
> gcc/ChangeLog:
>
> 	* pair-fusion.h (enum class writeback): Rename to...
> 	(enum class writeback_type): ...this.
> 	(struct pair_fusion): Adjust type name after renaming.
> 	* pair-fusion.cc (pair_fusion_bb_info::track_access): Likewise.
> 	(pair_fusion_bb_info::fuse_pair): Likewise.
> 	(pair_fusion::process_block): Likewise.

OK, thanks, and sorry for missing this during the review.

Richard

> ---
> Patch discussed in https://inbox.sourceware.org/gcc-patches/mptwmn93njq.fsf@arm.com/
>
> Tested on x86_64-linux-gnu. OK for master?
>
>  gcc/pair-fusion.cc | 6 +++---
>  gcc/pair-fusion.h  | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/pair-fusion.cc b/gcc/pair-fusion.cc
> index 9f897ac04e2..26b2284ed37 100644
> --- a/gcc/pair-fusion.cc
> +++ b/gcc/pair-fusion.cc
> @@ -426,7 +426,7 @@ pair_fusion_bb_info::track_access (insn_info *insn, bool load_p, rtx mem)
>      return;
>  
>    // Ignore writeback accesses if the hook says to do so.
> -  if (!m_pass->should_handle_writeback (writeback::EXISTING)
> +  if (!m_pass->should_handle_writeback (writeback_type::EXISTING)
>        && GET_RTX_CLASS (GET_CODE (XEXP (mem, 0))) == RTX_AUTOINC)
>      return;
>  
> @@ -1787,7 +1787,7 @@ pair_fusion_bb_info::fuse_pair (bool load_p,
>    // update of the base register and try and fold it in to make this into a
>    // writeback pair.
>    insn_info *trailing_add = nullptr;
> -  if (m_pass->should_handle_writeback (writeback::ALL)
> +  if (m_pass->should_handle_writeback (writeback_type::ALL)
>        && !writeback_effect
>        && (!load_p || (!refers_to_regno_p (base_regno, base_regno + 1,
>  					 XEXP (pats[0], 0), nullptr)
> @@ -2996,7 +2996,7 @@ void pair_fusion::process_block (bb_info *bb)
>        rtx pat = PATTERN (rti);
>        bool load_p;
>        if (reload_completed
> -	  && should_handle_writeback (writeback::ALL)
> +	  && should_handle_writeback (writeback_type::ALL)
>  	  && pair_mem_insn_p (rti, load_p))
>  	try_promote_writeback (insn, load_p);
>  
> diff --git a/gcc/pair-fusion.h b/gcc/pair-fusion.h
> index 2a38dc8f743..45e4edceecb 100644
> --- a/gcc/pair-fusion.h
> +++ b/gcc/pair-fusion.h
> @@ -75,7 +75,7 @@ struct alias_walker;
>  
>  // When querying should_handle_writeback, this enum is used to
>  // qualify which opportunities we are asking about.
> -enum class writeback {
> +enum class writeback_type {
>    // Only those writeback opportunities that arise from existing
>    // auto-increment accesses.
>    EXISTING,
> @@ -123,7 +123,7 @@ struct pair_fusion {
>    // Return true if we should try to handle writeback opportunities.
>    // WHICH determines the kinds of writeback opportunities the caller
>    // is asking about.
> -  virtual bool should_handle_writeback (enum writeback which) = 0;
> +  virtual bool should_handle_writeback (writeback_type which) = 0;
>  
>    // Given BASE_MEM, the mem from the lower candidate access for a pair,
>    // and LOAD_P (true if the access is a load), check if we should proceed

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

* Re: [PATCH] pair-fusion: fix for older GCC
  2024-06-03  8:08 ` Richard Sandiford
@ 2024-06-03  9:21   ` Marc Poulhiès
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Poulhiès @ 2024-06-03  9:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ajit Agarwal, richard.sandiford

Richard Sandiford <richard.sandiford@arm.com> writes:

> Marc Poulhiès <poulhies@adacore.com> writes:
>> Older GCCs fail with:
>>
>>   .../gcc/pair-fusion.cc: In member function ‘bool pair_fusion_bb_info::fuse_pair(bool, unsigned int, int, rtl_ssa::insn_info*, rtl_ssa::in
>>   sn_info*, base_cand&, const rtl_ssa::insn_range_info&)’:
>>   .../gcc/pair-fusion.cc:1790:40: error: ‘writeback’ is not a class, namespace, or enumeration
>>      if (m_pass->should_handle_writeback (writeback::ALL)
>>
>> Renaming the enum type works around the name conflict with the local
>> variable and also prevents future similar conflicts.
>>
>> gcc/ChangeLog:
>>
>> 	* pair-fusion.h (enum class writeback): Rename to...
>> 	(enum class writeback_type): ...this.
>> 	(struct pair_fusion): Adjust type name after renaming.
>> 	* pair-fusion.cc (pair_fusion_bb_info::track_access): Likewise.
>> 	(pair_fusion_bb_info::fuse_pair): Likewise.
>> 	(pair_fusion::process_block): Likewise.
>
> OK, thanks, and sorry for missing this during the review.

This breaks aarch64:

https://builder.sourceware.org/buildbot/#/builders/266/builds/3487/steps/4/logs/stdio

I'll try to send a followup fix quickly...

Marc

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

end of thread, other threads:[~2024-06-03  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-03  7:57 [PATCH] pair-fusion: fix for older GCC Marc Poulhiès
2024-06-03  8:08 ` Richard Sandiford
2024-06-03  9:21   ` Marc Poulhiès

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).