public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] regalloc: Ignore '^' in early costing [PR114766]
@ 2024-04-29 12:59 Wilco Dijkstra
  2024-04-30 20:12 ` Vladimir Makarov
  0 siblings, 1 reply; 2+ messages in thread
From: Wilco Dijkstra @ 2024-04-29 12:59 UTC (permalink / raw)
  To: GCC Patches; +Cc: vmakarov


According to documentation, '^' should only have an effect during reload.
However ira-costs.cc treats it in the same way as '?' during early costing.
As a result using '^' can accidentally disable valid alternatives and cause
significant regressions (see PR114741).  Avoid this by ignoring '^' during
costing.

Passes bootstrap and regress, OK for commit?

gcc:
        PR rtl-optimization/114766
        * ira-costs.cc (record_reg_classes): Ignore '^' during costing.

---

diff --git a/gcc/ira-costs.cc b/gcc/ira-costs.cc
index c86c5a16563aeefac9d4fa72839bee8d95409f4b..04d2f21b023f3456ba6f8c16c2418d7313965b2f 100644
--- a/gcc/ira-costs.cc
+++ b/gcc/ira-costs.cc
@@ -771,10 +771,6 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
 		  c = *++p;
 		  break;
 
-		case '^':
-		  alt_cost += 2;
-		  break;
-
 		case '?':
 		  alt_cost += 2;
 		  break;


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

* Re: [PATCH] regalloc: Ignore '^' in early costing [PR114766]
  2024-04-29 12:59 [PATCH] regalloc: Ignore '^' in early costing [PR114766] Wilco Dijkstra
@ 2024-04-30 20:12 ` Vladimir Makarov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Makarov @ 2024-04-30 20:12 UTC (permalink / raw)
  To: Wilco Dijkstra, GCC Patches


On 4/29/24 08:59, Wilco Dijkstra wrote:
> According to documentation, '^' should only have an effect during reload.
> However ira-costs.cc treats it in the same way as '?' during early costing.
> As a result using '^' can accidentally disable valid alternatives and cause
> significant regressions (see PR114741).  Avoid this by ignoring '^' during
> costing.
>
> Passes bootstrap and regress, OK for commit?
>
> gcc:
>          PR rtl-optimization/114766
>          * ira-costs.cc (record_reg_classes): Ignore '^' during costing.
>
Sorry, I can not accept this patch.  This constraint is used by other 
targets (as I know rs6000, s390, sh, gcn).  I suspect changing the 
semantics can affect the targets in some undesirable way.

Saying that, I understand that aarch64 needs the new semantics. So I 
think we can add a new hint with the required semantics. There are still 
few undefined characters for the new hint: '~', '-', '/', and '.' (may 
be I missed some),

I propose to use '~' for the new hint. So besides changing code, the 
documentation for '^' needs to clarified and documentation for code '~' 
should be added.

>
> diff --git a/gcc/ira-costs.cc b/gcc/ira-costs.cc
> index c86c5a16563aeefac9d4fa72839bee8d95409f4b..04d2f21b023f3456ba6f8c16c2418d7313965b2f 100644
> --- a/gcc/ira-costs.cc
> +++ b/gcc/ira-costs.cc
> @@ -771,10 +771,6 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
>   		  c = *++p;
>   		  break;
>   
> -		case '^':
> -		  alt_cost += 2;
> -		  break;
> -
>   		case '?':
>   		  alt_cost += 2;
>   		  break;
>
>
>


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

end of thread, other threads:[~2024-04-30 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-29 12:59 [PATCH] regalloc: Ignore '^' in early costing [PR114766] Wilco Dijkstra
2024-04-30 20:12 ` Vladimir Makarov

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