diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2009-01-29 18:37:30 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2009-01-29 18:37:30 +0000 |
| commit | d5a480270898166d512fe49fc61328211fd7c6b2 (patch) | |
| tree | 99f6ab417a1285d99b6eea14751316951842d6b2 /lib/CodeGen/RegAllocLocal.cpp | |
| parent | 2c65c3dfe6589a630d1bdde085aec1b9cdc43ea8 (diff) | |
Local register allocator shouldn't assume only the entry and landing pad basic blocks have live-ins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLocal.cpp')
| -rw-r--r-- | lib/CodeGen/RegAllocLocal.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 9fc5f738b4..a8c69008c2 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -710,24 +710,21 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) { DEBUG(const BasicBlock *LBB = MBB.getBasicBlock(); if (LBB) DOUT << "\nStarting RegAlloc of BB: " << LBB->getName()); - // If this is the first basic block in the machine function, add live-in - // registers as active. - if (&MBB == &*MF->begin() || MBB.isLandingPad()) { - for (MachineBasicBlock::livein_iterator I = MBB.livein_begin(), + // Add live-in registers as active. + for (MachineBasicBlock::livein_iterator I = MBB.livein_begin(), E = MBB.livein_end(); I != E; ++I) { - unsigned Reg = *I; - MF->getRegInfo().setPhysRegUsed(Reg); - PhysRegsUsed[Reg] = 0; // It is free and reserved now - AddToPhysRegsUseOrder(Reg); - for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); - *SubRegs; ++SubRegs) { - if (PhysRegsUsed[*SubRegs] != -2) { - AddToPhysRegsUseOrder(*SubRegs); - PhysRegsUsed[*SubRegs] = 0; // It is free and reserved now - MF->getRegInfo().setPhysRegUsed(*SubRegs); - } + unsigned Reg = *I; + MF->getRegInfo().setPhysRegUsed(Reg); + PhysRegsUsed[Reg] = 0; // It is free and reserved now + AddToPhysRegsUseOrder(Reg); + for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); + *SubRegs; ++SubRegs) { + if (PhysRegsUsed[*SubRegs] != -2) { + AddToPhysRegsUseOrder(*SubRegs); + PhysRegsUsed[*SubRegs] = 0; // It is free and reserved now + MF->getRegInfo().setPhysRegUsed(*SubRegs); } - } + } } ComputeLocalLiveness(MBB); |
