diff options
Diffstat (limited to 'llvm/lib/Target/X86/X86FloatingPoint.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FloatingPoint.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86FloatingPoint.cpp b/llvm/lib/Target/X86/X86FloatingPoint.cpp index 1e18a6769c9..d7f4eba6299 100644 --- a/llvm/lib/Target/X86/X86FloatingPoint.cpp +++ b/llvm/lib/Target/X86/X86FloatingPoint.cpp @@ -976,22 +976,24 @@ void FPS::shuffleStackTop(const unsigned char *FixStack, //===----------------------------------------------------------------------===// void FPS::handleCall(MachineBasicBlock::iterator &I) { + MachineInstr &MI = *I; unsigned STReturns = 0; const MachineFunction* MF = I->getParent()->getParent(); - for (const auto &MO : I->operands()) { - if (!MO.isReg()) + for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { + MachineOperand &Op = MI.getOperand(i); + if (!Op.isReg() || Op.getReg() < X86::FP0 || Op.getReg() > X86::FP6) continue; - unsigned R = MO.getReg() - X86::FP0; + assert(Op.isImplicit() && "Expected implicit def/use"); - if (R < 8) { - if (MF->getFunction().getCallingConv() != CallingConv::X86_RegCall) { - assert(MO.isDef() && MO.isImplicit()); - } + if (Op.isDef()) + STReturns |= 1 << getFPReg(Op); - STReturns |= 1 << R; - } + // Remove the operand so that later passes don't see it. + MI.RemoveOperand(i); + --i; + --e; } unsigned N = countTrailingOnes(STReturns); |