VirtRegMap: Improve block live-in info if subregister liveness is available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223894 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun 2014-12-10 01:13:08 +00:00
parent d7965336f9
commit 8f08002f03

View File

@ -252,15 +252,38 @@ void VirtRegRewriter::addMBBLiveIns() {
unsigned PhysReg = VRM->getPhys(VirtReg);
assert(PhysReg != VirtRegMap::NO_PHYS_REG && "Unmapped virtual register.");
// Scan the segments of LI.
for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I != E;
++I) {
if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))
continue;
for (unsigned i = 0, e = LiveIn.size(); i != e; ++i)
if (!LiveIn[i]->isLiveIn(PhysReg))
LiveIn[i]->addLiveIn(PhysReg);
LiveIn.clear();
if (LI.hasSubRanges()) {
for (LiveInterval::subrange_iterator S = LI.subrange_begin(),
SE = LI.subrange_end(); S != SE; ++S) {
for (LiveRange::const_iterator I = S->begin(), E = S->end(); I != E;
++I) {
if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))
continue;
for (MCSubRegIndexIterator SR(PhysReg, TRI); SR.isValid(); ++SR) {
unsigned SubReg = SR.getSubReg();
unsigned SubRegIndex = SR.getSubRegIndex();
unsigned SubRegLaneMask = TRI->getSubRegIndexLaneMask(SubRegIndex);
if ((SubRegLaneMask & S->LaneMask) == 0)
continue;
for (unsigned i = 0, e = LiveIn.size(); i != e; ++i) {
if (!LiveIn[i]->isLiveIn(SubReg))
LiveIn[i]->addLiveIn(SubReg);
}
}
LiveIn.clear();
}
}
} else {
// Scan the segments of LI.
for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I != E;
++I) {
if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))
continue;
for (unsigned i = 0, e = LiveIn.size(); i != e; ++i)
if (!LiveIn[i]->isLiveIn(PhysReg))
LiveIn[i]->addLiveIn(PhysReg);
LiveIn.clear();
}
}
}
}