public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2584] ira: Skip empty regclass when setting up reg class relations
@ 2023-07-17 14:51 Senthil Kumar Selvaraj
  0 siblings, 0 replies; only message in thread
From: Senthil Kumar Selvaraj @ 2023-07-17 14:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:08b99fe8ad6c7ed1fe7a9f352df5aac0b2f3a72b

commit r14-2584-g08b99fe8ad6c7ed1fe7a9f352df5aac0b2f3a72b
Author: Senthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
Date:   Mon Jul 17 20:04:36 2023 +0530

    ira: Skip empty regclass when setting up reg class relations
    
    ira.cc:setup_reg_class_relations sets up ira_reg_class_subset (among
    other things). If reg class cl3 has no registers, then that empty set
    is always hard_reg_set_subset_p of any other set, and this makes
    ira_reg_class_subset[ALL_REGS][NO_REGS] equal to such a regclass,
    rather than NO_REGS.
    
    This breaks code (lra-constraints.cc:in_class_p/curr_insn_transform,
    for e.g.) which uses NO_REGS to check for an empty regclass.
    
    Why define an empty regclass? A regclass could be conditionally empty (via
    TARGET_CONDITIONAL_REGISTER_USAGE) - for the avr target, ADDW_REGS and
    NO_LD_REGS are empty for the avrtiny subarch, for example.
    
    Fix by continuing the innermost loop if the corresponding reg class is empty.
    
    gcc/ChangeLog:
    
            * ira.cc (setup_reg_class_relations): Continue
            if regclass cl3 is hard_reg_set_empty_p.

Diff:
---
 gcc/ira.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/ira.cc b/gcc/ira.cc
index 4a6fb357ba0..0b0d460689d 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -1259,6 +1259,9 @@ setup_reg_class_relations (void)
 	  for (cl3 = 0; cl3 < N_REG_CLASSES; cl3++)
 	    {
 	      temp_hard_regset = reg_class_contents[cl3] & ~no_unit_alloc_regs;
+	      if (hard_reg_set_empty_p (temp_hard_regset))
+	        continue;
+
 	      if (hard_reg_set_subset_p (temp_hard_regset, intersection_set))
 		{
 		  /* CL3 allocatable hard register set is inside of

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-17 14:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 14:51 [gcc r14-2584] ira: Skip empty regclass when setting up reg class relations Senthil Kumar Selvaraj

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