From 98703350d02c49026472db2d55ab171ed6b07670 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 11 Oct 2011 00:10:41 +0000 Subject: [PATCH] Simplify check that optional def is there and is CPSR. llvm-svn: 141602 --- llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp b/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp index 2bf99bfd5c3d..b6274007b237 100644 --- a/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp +++ b/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp @@ -140,11 +140,10 @@ Thumb2ITBlockPass::MoveCopyOutOfITBlock(MachineInstr *MI, // rsb r1, 0 // rsb r2, 0 // - // - for (unsigned I = 0, E = MI->getNumOperands(); I != E; ++I) - if (MI->getOperand(I).isReg() && MI->getOperand(I).getReg() == ARM::CPSR && - MI->getOperand(I).isDef()) - return false; + const MCInstrDesc &MCID = MI->getDesc(); + if (MCID.hasOptionalDef() && + MI->getOperand(MCID.getNumOperands() - 1).getReg() == ARM::CPSR) + return false; // Then peek at the next instruction to see if it's predicated on CC or OCC. // If not, then there is nothing to be gained by moving the copy.