diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
| commit | 344a3780b2e33f6ca763666c380202b18aab72a3 (patch) | |
| tree | f0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/lib/CodeGen/LiveRegUnits.cpp | |
| parent | b60736ec1405bb0a8dd40989f67ef4c93da068ab (diff) | |
vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0evendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f
Diffstat (limited to 'llvm/lib/CodeGen/LiveRegUnits.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/LiveRegUnits.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveRegUnits.cpp b/llvm/lib/CodeGen/LiveRegUnits.cpp index ea2075bc139d..d8d8bd5d61a2 100644 --- a/llvm/lib/CodeGen/LiveRegUnits.cpp +++ b/llvm/lib/CodeGen/LiveRegUnits.cpp @@ -81,8 +81,17 @@ static void addBlockLiveIns(LiveRegUnits &LiveUnits, static void addCalleeSavedRegs(LiveRegUnits &LiveUnits, const MachineFunction &MF) { const MachineRegisterInfo &MRI = MF.getRegInfo(); - for (const MCPhysReg *CSR = MRI.getCalleeSavedRegs(); CSR && *CSR; ++CSR) - LiveUnits.addReg(*CSR); + const MachineFrameInfo &MFI = MF.getFrameInfo(); + for (const MCPhysReg *CSR = MRI.getCalleeSavedRegs(); CSR && *CSR; ++CSR) { + const unsigned N = *CSR; + + const auto &CSI = MFI.getCalleeSavedInfo(); + auto Info = + llvm::find_if(CSI, [N](auto Info) { return Info.getReg() == N; }); + // If we have no info for this callee-saved register, assume it is liveout + if (Info == CSI.end() || Info->isRestored()) + LiveUnits.addReg(N); + } } void LiveRegUnits::addPristines(const MachineFunction &MF) { |
