From 8c562574ebc37fe07b5473c12e1dc08c96e4e3e6 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 21 May 2010 18:01:24 +0000 Subject: [PATCH] use continue to reduce nesting. llvm-svn: 104330 --- lib/Target/X86/X86FloatingPointRegKill.cpp | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/Target/X86/X86FloatingPointRegKill.cpp b/lib/Target/X86/X86FloatingPointRegKill.cpp index 34f45fd8cc2..97a43f2b95d 100644 --- a/lib/Target/X86/X86FloatingPointRegKill.cpp +++ b/lib/Target/X86/X86FloatingPointRegKill.cpp @@ -57,22 +57,25 @@ FunctionPass *llvm::createX87FPRegKillInserterPass() { /// stack code, and thus needs an FP_REG_KILL. static bool ContainsFPStackCode(MachineBasicBlock *MBB, unsigned SSELevel, MachineRegisterInfo &MRI) { - + // Scan the block, looking for instructions that define fp stack vregs. for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { - if (I->getNumOperands() != 0 && I->getOperand(0).isReg()) { - for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) { - if (I->getOperand(op).isReg() && I->getOperand(op).isDef() && - TargetRegisterInfo::isVirtualRegister(I->getOperand(op).getReg())) { - const TargetRegisterClass *RegClass = - MRI.getRegClass(I->getOperand(op).getReg()); - - if (RegClass == X86::RFP32RegisterClass || - RegClass == X86::RFP64RegisterClass || - RegClass == X86::RFP80RegisterClass) - return true; - } - } + if (I->getNumOperands() == 0 || !I->getOperand(0).isReg()) + continue; + + for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) { + if (!I->getOperand(op).isReg() || !I->getOperand(op).isDef() || + !TargetRegisterInfo::isVirtualRegister(I->getOperand(op).getReg())) + continue; + + const TargetRegisterClass *RegClass = + MRI.getRegClass(I->getOperand(op).getReg()); + + switch (RegClass->getID()) + case X86::RFP32RegClassID: + case X86::RFP64RegClassID: + case X86::RFP80RegClassID: + return true; } }