aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorTim Northover <t.p.northover@gmail.com>2021-05-11 09:57:18 +0100
committerTim Northover <t.p.northover@gmail.com>2021-05-19 11:00:24 +0100
commitc1dc267258e06bb69e1ca217d1d8ce2d15b8757f (patch)
tree10d529c26b7d863886276e773208a37aa748215c /llvm/lib/CodeGen/RegAllocFast.cpp
parent4f86aa650c40196754df22c421d551d129c9149a (diff)
downloadllvm-c1dc267258e06bb69e1ca217d1d8ce2d15b8757f.zip
llvm-c1dc267258e06bb69e1ca217d1d8ce2d15b8757f.tar.gz
llvm-c1dc267258e06bb69e1ca217d1d8ce2d15b8757f.tar.bz2
MachineBasicBlock: add liveout iterator aware of which liveins are defined by the runtime.
Using this in RegAlloc fast reduces register pressure, and in some cases allows x86 code to compile that wouldn't before.
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocFast.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index b6d4cd2..8a964ef 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -1452,10 +1452,8 @@ void RegAllocFast::allocateBasicBlock(MachineBasicBlock &MBB) {
RegUnitStates.assign(TRI->getNumRegUnits(), regFree);
assert(LiveVirtRegs.empty() && "Mapping not cleared from last block?");
- for (MachineBasicBlock *Succ : MBB.successors()) {
- for (const MachineBasicBlock::RegisterMaskPair &LI : Succ->liveins())
- setPhysRegState(LI.PhysReg, regPreAssigned);
- }
+ for (auto &LiveReg : MBB.liveouts())
+ setPhysRegState(LiveReg.PhysReg, regPreAssigned);
Coalesced.clear();