Am 11.01.25 um 19:15 schrieb Denis Chertykov:
The fix for PR117868.
[...]

     PR rtl-optimization/117868
gcc/
     * lra-spills.cc (assign_stack_slot_num_and_sort_pseudos): Reuse slots
     only without allocated memory or only with equal or smaller registers
     with equal or smaller alignment.
     (lra_spill): Print slot size as width.


diff --git a/gcc/lra-spills.cc b/gcc/lra-spills.cc
index db78dcd28a3..93a0c92db9f 100644
--- a/gcc/lra-spills.cc
+++ b/gcc/lra-spills.cc
@@ -386,7 +386,18 @@ assign_stack_slot_num_and_sort_pseudos (int *pseudo_regnos, int n)
          && ! (lra_intersected_live_ranges_p
                (slots[j].live_ranges,
                 lra_reg_info[regno].live_ranges)))
-          break;
+          {
+        /* A slot without allocated memory can be shared.  */
+        if (slots[j].mem == NULL_RTX)
+          break;
+
+        /* A slot with allocated memory can be shared only with equal
+           or smaller register with equal or smaller alignment.  */
+        if (slots[j].align >= spill_slot_alignment (mode)
+            && compare_sizes_for_sort (slots[j].size,
+                           GET_MODE_SIZE (mode)) != -1)
+          break;
+          }
      }
        if (j >= slots_num)
      {
@@ -656,8 +667,7 @@ lra_spill (void)
        for (i = 0; i < slots_num; i++)
      {
        fprintf (lra_dump_file, "  Slot %d regnos (width = ", i);
-      print_dec (GET_MODE_SIZE (GET_MODE (slots[i].mem)),
-             lra_dump_file, SIGNED);
+      print_dec (slots[i].size, lra_dump_file, SIGNED);
        fprintf (lra_dump_file, "):");
        for (curr_regno = slots[i].regno;;
             curr_regno = pseudo_slots[curr_regno].next - pseudo_slots)


Trying to apply this, I am getting:

.../gcc$ patch -p2 <  ~/gnu/patches/pr117868.diff
patching file lra-spills.cc
Hunk #1 FAILED at 386.
Hunk #2 FAILED at 656.
2 out of 2 hunks FAILED -- saving rejects to file lra-spills.cc.rej

Maybe it's because in the mail TABs have been replaced by spaces?

Johann

Reply via email to