When SimpleRegisterCoalescing is trimming kill flags on a physical register

operand, also check if subregisters are killed.

Add <imp-def> operands for subregisters that remain alive after a super register
is killed.

I don't have a testcase for this that reproduces on trunk. <rdar://problem/8441758>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116940 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2010-10-20 18:45:55 +00:00
parent 64e6719ee8
commit 9b25940474

View File

@ -1767,8 +1767,18 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {
if (!MO.isReg() || !MO.isKill()) continue;
unsigned reg = MO.getReg();
if (!reg || !li_->hasInterval(reg)) continue;
if (!li_->getInterval(reg).killedAt(DefIdx))
if (!li_->getInterval(reg).killedAt(DefIdx)) {
MO.setIsKill(false);
continue;
}
// When leaving a kill flag on a physreg, check if any subregs should
// remain alive.
if (!TargetRegisterInfo::isPhysicalRegister(reg))
continue;
for (const unsigned *SR = tri_->getSubRegisters(reg);
unsigned S = *SR; ++SR)
if (li_->hasInterval(S) && li_->getInterval(S).liveAt(DefIdx))
MI->addRegisterDefined(S, tri_);
}
}
}