The following patch is to solve PR48336, PR48342, PR48345. The
profitable hard regs exclude hard regs which are prohibited for the
corresponding allocno mode. It is true for primary allocation and it is
important for better colorability criteria. Function assign_hard_reg is
also based on this assumption. Unfortunately, it is not true for
secondary allocation (after IRA IR flattening or during reload). The
following patch solves this problem.
The patch should be very safe but I am still testing it on x86/x86-64
bootstrap.
Is it ok to commit the patch after successful bootsrapping?
2011-03-29 Vladimir Makarov <vmaka...@redhat.com>
PR target/48336
PR middle-end/4834
PR rtl-optimization/48345
* ira-color.c (setup_conflict_profitable_regs): Exclude prohibited
hard regs for given mode from profitable regs when doing secondary
allocation.
Index: ira-color.c
===================================================================
--- ira-color.c (revision 171699)
+++ ira-color.c (working copy)
@@ -1447,7 +1447,9 @@ update_conflict_hard_regno_costs (int *c
}
/* Set up conflicting and profitable regs (through CONFLICT_REGS and
- PROFITABLE_REGS) for each object of allocno A. */
+ PROFITABLE_REGS) for each object of allocno A. Remember that the
+ profitable regs exclude hard regs which can not hold value of mode
+ of allocno A. */
static inline void
setup_conflict_profitable_regs (ira_allocno_t a, bool retry_p,
HARD_REG_SET *conflict_regs,
@@ -1463,8 +1465,13 @@ setup_conflict_profitable_regs (ira_allo
COPY_HARD_REG_SET (conflict_regs[i],
OBJECT_TOTAL_CONFLICT_HARD_REGS (obj));
if (retry_p)
- COPY_HARD_REG_SET (profitable_regs[i],
- reg_class_contents[ALLOCNO_CLASS (a)]);
+ {
+ COPY_HARD_REG_SET (profitable_regs[i],
+ reg_class_contents[ALLOCNO_CLASS (a)]);
+ AND_COMPL_HARD_REG_SET (profitable_regs[i],
+ ira_prohibited_class_mode_regs
+ [ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
+ }
else
COPY_HARD_REG_SET (profitable_regs[i],
OBJECT_COLOR_DATA (obj)->profitable_hard_regs);