diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-07-08 18:26:20 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-07-08 18:26:20 +0000 |
| commit | 25b132e93b2b8b99c91463d381ac13a522048a61 (patch) | |
| tree | 574c742b3cd7be664882afa68fcc95ed5007dd4d /llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp | |
| parent | 3e2576f9682e72faa87025a349be5b34c8f9585f (diff) | |
| download | bcm5719-llvm-25b132e93b2b8b99c91463d381ac13a522048a61.tar.gz bcm5719-llvm-25b132e93b2b8b99c91463d381ac13a522048a61.zip | |
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
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp b/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp index b7515679ce8..49e334aedff 100644 --- a/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp +++ b/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp @@ -465,11 +465,11 @@ bool AArch64BranchRelaxation::relaxBranchInstructions() { // end() for termination. for (MachineFunction::iterator I = MF->begin(); I != MF->end(); ++I) { MachineBasicBlock &MBB = *I; - MachineInstr *MI = MBB.getFirstTerminator(); - if (isConditionalBranch(MI->getOpcode()) && - !isBlockInRange(MI, getDestBlock(MI), - getBranchDisplacementBits(MI->getOpcode()))) { - fixupConditionalBranch(MI); + MachineInstr &MI = *MBB.getFirstTerminator(); + if (isConditionalBranch(MI.getOpcode()) && + !isBlockInRange(&MI, getDestBlock(&MI), + getBranchDisplacementBits(MI.getOpcode()))) { + fixupConditionalBranch(&MI); ++NumRelaxed; Changed = true; } |

