From 25b132e93b2b8b99c91463d381ac13a522048a61 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 8 Jul 2016 18:26:20 +0000 Subject: Target: Avoid getFirstTerminator() => pointer, NFC Stop using an implicit conversion from the return of MachineBasicBlock::getFirstTerminator to MachineInstr*. In two cases, directly dereference to a MachineInstr& since later code assumes it's valid. In a third case, change to an iterator since later code checks against MachineBasicBlock::end. Although the fix for the third case avoids undefined behaviour, I expect this doesn't cause a functionality change in practice (since the basic block already has a terminator). llvm-svn: 274898 --- llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp') diff --git a/llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp b/llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp index 5a11a05bba8..935a1433107 100644 --- a/llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp +++ b/llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp @@ -275,13 +275,13 @@ void AArch64ConditionOptimizer::modifyCmp(MachineInstr *CmpMI, // The fact that this comparison was picked ensures that it's related to the // first terminator instruction. - MachineInstr *BrMI = MBB->getFirstTerminator(); + MachineInstr &BrMI = *MBB->getFirstTerminator(); // Change condition in branch instruction. - BuildMI(*MBB, BrMI, BrMI->getDebugLoc(), TII->get(AArch64::Bcc)) + BuildMI(*MBB, BrMI, BrMI.getDebugLoc(), TII->get(AArch64::Bcc)) .addImm(Cmp) - .addOperand(BrMI->getOperand(1)); - BrMI->eraseFromParent(); + .addOperand(BrMI.getOperand(1)); + BrMI.eraseFromParent(); MBB->updateTerminator(); -- cgit v1.2.3