mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 06:06:19 +00:00
Allow more cross-rc coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c608784dc8
commit
bfc9999563
@ -93,16 +93,19 @@ bool MachineCSE::PerformTrivialCoalescing(MachineInstr *MI,
|
||||
if (TII->isMoveInstr(*DefMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx) &&
|
||||
TargetRegisterInfo::isVirtualRegister(SrcReg) &&
|
||||
!SrcSubIdx && !DstSubIdx) {
|
||||
const TargetRegisterClass *SRC = MRI->getRegClass(SrcReg);
|
||||
const TargetRegisterClass *RC = MRI->getRegClass(Reg);
|
||||
if (SRC == RC || RC->hasSubClass(SRC)) {
|
||||
DEBUG(dbgs() << "Coalescing: " << *DefMI);
|
||||
DEBUG(dbgs() << "*** to: " << *MI);
|
||||
MO.setReg(SrcReg);
|
||||
DefMI->eraseFromParent();
|
||||
++NumCoalesces;
|
||||
Changed = true;
|
||||
}
|
||||
const TargetRegisterClass *SRC = MRI->getRegClass(SrcReg);
|
||||
const TargetRegisterClass *RC = MRI->getRegClass(Reg);
|
||||
const TargetRegisterClass *NewRC = getCommonSubClass(RC, SRC);
|
||||
if (!NewRC)
|
||||
continue;
|
||||
DEBUG(dbgs() << "Coalescing: " << *DefMI);
|
||||
DEBUG(dbgs() << "*** to: " << *MI);
|
||||
MO.setReg(SrcReg);
|
||||
if (NewRC != SRC)
|
||||
MRI->setRegClass(SrcReg, NewRC);
|
||||
DefMI->eraseFromParent();
|
||||
++NumCoalesces;
|
||||
Changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user