AArch64: Use MachineInstr& in guaranteesZeroRegInBlock(), NFC

llvm-svn: 262143
This commit is contained in:
Duncan P. N. Exon Smith 2016-02-27 19:12:54 +00:00
parent 5702287809
commit 1f6624ae34
1 changed files with 6 additions and 6 deletions

View File

@ -63,15 +63,15 @@ char AArch64RedundantCopyElimination::ID = 0;
INITIALIZE_PASS(AArch64RedundantCopyElimination, "aarch64-copyelim", INITIALIZE_PASS(AArch64RedundantCopyElimination, "aarch64-copyelim",
"AArch64 redundant copy elimination pass", false, false) "AArch64 redundant copy elimination pass", false, false)
static bool guaranteesZeroRegInBlock(MachineInstr *MI, MachineBasicBlock *MBB) { static bool guaranteesZeroRegInBlock(MachineInstr &MI, MachineBasicBlock *MBB) {
unsigned Opc = MI->getOpcode(); unsigned Opc = MI.getOpcode();
// Check if the current basic block is the target block to which the // Check if the current basic block is the target block to which the
// CBZ/CBNZ instruction jumps when its Wt/Xt is zero. // CBZ/CBNZ instruction jumps when its Wt/Xt is zero.
if ((Opc == AArch64::CBZW || Opc == AArch64::CBZX) && if ((Opc == AArch64::CBZW || Opc == AArch64::CBZX) &&
MBB == MI->getOperand(1).getMBB()) MBB == MI.getOperand(1).getMBB())
return true; return true;
else if ((Opc == AArch64::CBNZW || Opc == AArch64::CBNZX) && else if ((Opc == AArch64::CBNZW || Opc == AArch64::CBNZX) &&
MBB != MI->getOperand(1).getMBB()) MBB != MI.getOperand(1).getMBB())
return true; return true;
return false; return false;
@ -90,12 +90,12 @@ bool AArch64RedundantCopyElimination::optimizeCopy(MachineBasicBlock *MBB) {
++CompBr; ++CompBr;
do { do {
--CompBr; --CompBr;
if (guaranteesZeroRegInBlock(CompBr, MBB)) if (guaranteesZeroRegInBlock(*CompBr, MBB))
break; break;
} while (CompBr != PredMBB->begin() && CompBr->isTerminator()); } while (CompBr != PredMBB->begin() && CompBr->isTerminator());
// We've not found a CBZ/CBNZ, time to bail out. // We've not found a CBZ/CBNZ, time to bail out.
if (!guaranteesZeroRegInBlock(CompBr, MBB)) if (!guaranteesZeroRegInBlock(*CompBr, MBB))
return false; return false;
unsigned TargetReg = CompBr->getOperand(0).getReg(); unsigned TargetReg = CompBr->getOperand(0).getReg();