1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Use COPY in X86FastISel::X86SelectRet.

Don't try a cross-class copy. That is very unlikely anywy since return value
registers are usually register class friendly. (%EAX, %XMM0, etc).

llvm-svn: 108074
This commit is contained in:
Jakob Stoklund Olesen 2010-07-11 05:17:02 +00:00
parent e2f74d400c
commit 08fc7eaaa2

View File

@ -757,13 +757,11 @@ bool X86FastISel::X86SelectRet(const Instruction *I) {
unsigned SrcReg = Reg + VA.getValNo();
unsigned DstReg = VA.getLocReg();
const TargetRegisterClass* SrcRC = MRI.getRegClass(SrcReg);
const TargetRegisterClass* DstRC = TRI.getMinimalPhysRegClass(DstReg);
bool Emitted = TII.copyRegToReg(*FuncInfo.MBB, FuncInfo.InsertPt,
DstReg, SrcReg, DstRC, SrcRC, DL);
// If the target couldn't make the copy for some reason, bail.
if (!Emitted)
// Avoid a cross-class copy. This is very unlikely.
if (!SrcRC->contains(DstReg))
return false;
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(TargetOpcode::COPY),
DstReg).addReg(SrcReg);
// Mark the register as live out of the function.
MRI.addLiveOut(VA.getLocReg());