mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
- Update the virtual reg to machine instruction map when hoisting.
- Fix subtle bug when creating initially creating this map. llvm-svn: 44873
This commit is contained in:
parent
9f02f24469
commit
30281897da
@ -215,7 +215,7 @@ void MachineLICM::MapVirtualRegisterDefs(const MachineFunction &MF) {
|
||||
const MachineInstr &MI = *II;
|
||||
|
||||
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
|
||||
const MachineOperand &MO = MI.getOperand(0);
|
||||
const MachineOperand &MO = MI.getOperand(i);
|
||||
|
||||
if (MO.isRegister() && MO.isDef() &&
|
||||
MRegisterInfo::isVirtualRegister(MO.getReg()))
|
||||
@ -317,7 +317,17 @@ void MachineLICM::Hoist(MachineInstr &MI) {
|
||||
"The predecessor doesn't feed directly into the loop header!");
|
||||
|
||||
// Now move the instructions to the predecessor.
|
||||
MoveInstToEndOfBlock(MBB, MI.clone());
|
||||
MachineInstr *NewMI = MI.clone();
|
||||
MoveInstToEndOfBlock(MBB, NewMI);
|
||||
|
||||
// Update VRegDefs.
|
||||
for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) {
|
||||
const MachineOperand &MO = NewMI->getOperand(i);
|
||||
|
||||
if (MO.isRegister() && MO.isDef() &&
|
||||
MRegisterInfo::isVirtualRegister(MO.getReg()))
|
||||
VRegDefs[MO.getReg()] = NewMI;
|
||||
}
|
||||
|
||||
// Hoisting was successful! Remove bothersome instruction now.
|
||||
MI.getParent()->remove(&MI);
|
||||
|
Loading…
Reference in New Issue
Block a user