mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Process all uses first before defs to accurately capture register liveness. rdar://10449480
llvm-svn: 144770
This commit is contained in:
parent
c2a46f1a90
commit
d756c3ec65
@ -1115,6 +1115,7 @@ TwoAddressInstructionPass::RescheduleKillAboveMI(MachineBasicBlock *MBB,
|
|||||||
MCID.isTerminator())
|
MCID.isTerminator())
|
||||||
// Don't move pass calls, etc.
|
// Don't move pass calls, etc.
|
||||||
return false;
|
return false;
|
||||||
|
SmallVector<unsigned, 2> OtherDefs;
|
||||||
for (unsigned i = 0, e = OtherMI->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = OtherMI->getNumOperands(); i != e; ++i) {
|
||||||
const MachineOperand &MO = OtherMI->getOperand(i);
|
const MachineOperand &MO = OtherMI->getOperand(i);
|
||||||
if (!MO.isReg())
|
if (!MO.isReg())
|
||||||
@ -1131,15 +1132,20 @@ TwoAddressInstructionPass::RescheduleKillAboveMI(MachineBasicBlock *MBB,
|
|||||||
// Don't want to extend other live ranges and update kills.
|
// Don't want to extend other live ranges and update kills.
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (Uses.count(MOReg))
|
OtherDefs.push_back(MOReg);
|
||||||
return false;
|
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
|
|
||||||
LiveDefs.count(MOReg))
|
|
||||||
return false;
|
|
||||||
// Physical register def is seen.
|
|
||||||
Defs.erase(MOReg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned i = 0, e = OtherDefs.size(); i != e; ++i) {
|
||||||
|
unsigned MOReg = OtherDefs[i];
|
||||||
|
if (Uses.count(MOReg))
|
||||||
|
return false;
|
||||||
|
if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
|
||||||
|
LiveDefs.count(MOReg))
|
||||||
|
return false;
|
||||||
|
// Physical register def is seen.
|
||||||
|
Defs.erase(MOReg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the old kill above MI, don't forget to move debug info as well.
|
// Move the old kill above MI, don't forget to move debug info as well.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user