]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[IRA]: Fix soft conflict and hard reg cost calculation
authorVladimir N. Makarov <vmakarov@redhat.com>
Thu, 30 Apr 2026 13:01:54 +0000 (09:01 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Thu, 30 Apr 2026 15:40:47 +0000 (11:40 -0400)
When finding soft conflict in IRA, we wrongly use conflict allocno mode.
This can result in more shuffling on the region borders and worse code
generation. The patch fixes this.

gcc/ChangeLog:

* ira-color.cc (assign_hard_reg): Use the right allocno mode to
call note_conflict.

gcc/ira-color.cc

index 279b36ef7d4d28694c4d410d9495bbbcdbd53cb3..953dbd94ad8084ba849bec04c2bef49a29f7beb0 100644 (file)
@@ -2107,8 +2107,9 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
                                  full_costs[hri] += cost;
                                }
                            };
+                         enum machine_mode a_mode = ALLOCNO_MODE (a);
                          for (int r = hard_regno;
-                              r >= 0 && (int) end_hard_regno (mode, r) > hard_regno;
+                              r >= 0 && (int) end_hard_regno (a_mode, r) > hard_regno;
                               r--)
                            note_conflict (r);
                          for (int r = hard_regno + 1;