https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109009
--- Comment #7 from Surya Kumari Jangala <jskumari at gcc dot gnu.org> --- There are a couple of issues in IRA: 1. In improve_allocation() routine, we are not considering save/restore cost of using a callee save register (r31 in the failing case). Due to this, r31 is being chosen instead of r3 for allocno r118. 2. In find_costs_and_classes(), we are not computing the cost of register moves when we have a 'set' insn that copies from one pseudo reg to another pseudo reg. This is resulting in r118 having ALLOCNO_CLASS_COST of 0.