HomePhabricator

[ARM][RegisterScavenging] Don't consider LR liveout if it is not reloaded

Authored by tmatheson on Jan 20 2021, 7:55 AM.

Description

[ARM][RegisterScavenging] Don't consider LR liveout if it is not reloaded

https://bugs.llvm.org/show_bug.cgi?id=48232

When PrologEpilogInserter writes callee-saved registers to the stack, LR is not reloaded but is instead loaded directly into PC.
This was not taken into account when determining if each callee-saved register was liveout for the block.
When frame elimination inserts virtual registers, and the register scavenger tries to scavenge LR, it considers it liveout and tries to spill again.
However there is no emergency spill slot to use, and it fails with an error:

fatal error: error in backend: Error while trying to spill LR from class GPR: Cannot scavenge register without an emergency spill slot!

This patch pervents any callee-saved registers which are not reloaded (including LR) from being marked liveout.
They are therefore available to scavenge without requiring an extra spill.

Details

Committed
tmathesonJan 28 2021, 1:22 AM
Parents
rG01b9e613c28b: [Clang][Codegen] Truncate initializers of union bitfield members
Branches
Unknown
Tags
Unknown