From 02ecc9a26324d142c5cd19d24526b9c23aabc1c3 Mon Sep 17 00:00:00 2001 From: Surya Kumari Jangala Date: Mon, 14 Aug 2023 09:34:56 -0500 Subject: [PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254] The improve_allocation() routine does not update the allocated_hardreg_p[] array after an allocno is assigned a register. If the register chosen in improve_allocation() is one that already has been assigned to a conflicting allocno, then allocated_hardreg_p[] already has the corresponding bit set to TRUE, so nothing needs to be done. But improve_allocation() can also choose a register that has not been assigned to a conflicting allocno, and also has not been assigned to any other allocno. In this case, allocated_hardreg_p[] has to be updated. 2023-07-21 Surya Kumari Jangala gcc/ PR rtl-optimization/110254 * ira-color.cc (improve_allocation): Update array allocated_hard_reg_p. --- gcc/ira-color.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc index 1fb2958bddd0..5807d6d26f6d 100644 --- a/gcc/ira-color.cc +++ b/gcc/ira-color.cc @@ -3340,6 +3340,10 @@ improve_allocation (void) } /* Assign the best chosen hard register to A. */ ALLOCNO_HARD_REGNO (a) = best; + + for (j = nregs - 1; j >= 0; j--) + allocated_hardreg_p[best + j] = true; + if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) fprintf (ira_dump_file, "Assigning %d to a%dr%d\n", best, ALLOCNO_NUM (a), ALLOCNO_REGNO (a)); -- 2.47.2