aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-07-27 13:24:16 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-07-27 13:24:16 +0000
commite5a22f44b83a1802efe699590471126cc4206e12 (patch)
tree7f7891dfc02380a2b504c8229f9fa9fa0764c270 /llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
parent79a947c2336c9cf12a588844d39422c9aa0a5658 (diff)
downloadllvm-e5a22f44b83a1802efe699590471126cc4206e12.zip
llvm-e5a22f44b83a1802efe699590471126cc4206e12.tar.gz
llvm-e5a22f44b83a1802efe699590471126cc4206e12.tar.bz2
PowerPC: Avoid implicit iterator conversions, NFC
Avoid implicit conversions from MachineInstrBundleIterator to MachineInstr* in the PowerPC backend, mainly by preferring MachineInstr& over MachineInstr* when a pointer isn't nullable and using range-based for loops. There was one piece of questionable code in PPCInstrInfo::AnalyzeBranch, where a condition checked a pointer converted from an iterator for nullptr. Since this case is impossible (moreover, the code above guarantees that the iterator is valid), I removed the check when I changed the pointer to a reference. Despite that case, there should be no functionality change here. llvm-svn: 276864
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCBranchSelector.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCBranchSelector.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp b/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
index 4d63c5b..6939304 100644
--- a/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
+++ b/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
@@ -186,9 +186,9 @@ bool PPCBSel::runOnMachineFunction(MachineFunction &Fn) {
}
// Otherwise, we have to expand it to a long branch.
- MachineInstr *OldBranch = I;
- DebugLoc dl = OldBranch->getDebugLoc();
-
+ MachineInstr &OldBranch = *I;
+ DebugLoc dl = OldBranch.getDebugLoc();
+
if (I->getOpcode() == PPC::BCC) {
// The BCC operands are:
// 0. PPC branch predicate
@@ -222,8 +222,8 @@ bool PPCBSel::runOnMachineFunction(MachineFunction &Fn) {
I = BuildMI(MBB, I, dl, TII->get(PPC::B)).addMBB(Dest);
// Remove the old branch from the function.
- OldBranch->eraseFromParent();
-
+ OldBranch.eraseFromParent();
+
// Remember that this instruction is 8-bytes, increase the size of the
// block by 4, remember to iterate.
BlockSizes[MBB.getNumber()] += 4;