On 10/18/2012 05:28 AM, Richard Sandiford wrote:
Hi Vlad,

newlib failed to build for mipsisa32-elf because of a case in which a
call-crossing pseudo P had been allocated a call-clobbered register and
in which LRA hadn't inserted the save and restore.  We then tripped the
lra-assigns.c sanity check for this situation (thanks for adding that btw).

The save and restore were missing from an EBB that looked like:

     ...
     P := ...
     ...
     call
     ...no references to P...

   bb1:
     insn I1

with P being live after I1 but not being live on any other exits
from the EBB.

I1 set up an equivalence that we decided to use, so we deleted it
and left bb1 empty.  This in turn meant that get_last_non_debug_insn (bb1)
returned null and that we recorded a null insn in usage_insns for P.
spill_if_necessary therefore thought no save/restore pair was needed.

I think in this situation we still want to insert the restore in bb1,
rather than in the previous block, so this patch makes get_last_non_debug_insn
return the block note for empty bbs and renames the function accordingly.

Also, it might be better to insert start-of-bb insns after the
block note rather than before the first nondebug insn.  The patch
does that too, for consistency.

Tested on x86_64-linux-gnu and mipsisa32-elf (which now builds).
OK for lra branch?

Yes.  Thanks, Richard.

Reply via email to