diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-07-12 03:18:50 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-07-12 03:18:50 +0000 |
commit | 7b4c18e8f38a0139e1f2ece643df9f7c21246b39 (patch) | |
tree | 219505b2f5c6f43af05c1c1f45aeeffa54774d4b /llvm/lib/Target/X86/X86CallFrameOptimization.cpp | |
parent | 99933f1b51d314d4eb7813f59911e14ecc07d4ff (diff) | |
download | bcm5719-llvm-7b4c18e8f38a0139e1f2ece643df9f7c21246b39.tar.gz bcm5719-llvm-7b4c18e8f38a0139e1f2ece643df9f7c21246b39.zip |
X86: Avoid implicit iterator conversions, NFC
Avoid implicit conversions from MachineInstrBundleIterator to
MachineInstr*, mainly by preferring MachineInstr& over MachineInstr* and
using range-based for loops.
llvm-svn: 275149
Diffstat (limited to 'llvm/lib/Target/X86/X86CallFrameOptimization.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86CallFrameOptimization.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86CallFrameOptimization.cpp b/llvm/lib/Target/X86/X86CallFrameOptimization.cpp index 79b2771a667..4b00355d09c 100644 --- a/llvm/lib/Target/X86/X86CallFrameOptimization.cpp +++ b/llvm/lib/Target/X86/X86CallFrameOptimization.cpp @@ -352,7 +352,7 @@ void X86CallFrameOptimization::collectCallInfo(MachineFunction &MF, // pointer is used directly. if (!I->isCopy() || !I->getOperand(0).isReg()) return; - Context.SPCopy = I++; + Context.SPCopy = &*I++; unsigned StackPtr = Context.SPCopy->getOperand(0).getReg(); @@ -406,7 +406,7 @@ void X86CallFrameOptimization::collectCallInfo(MachineFunction &MF, // If the same stack slot is being filled twice, something's fishy. if (Context.MovVector[StackDisp] != nullptr) return; - Context.MovVector[StackDisp] = I; + Context.MovVector[StackDisp] = &*I; for (const MachineOperand &MO : I->uses()) { if (!MO.isReg()) @@ -424,7 +424,7 @@ void X86CallFrameOptimization::collectCallInfo(MachineFunction &MF, if (I == MBB.end() || !I->isCall()) return; - Context.Call = I; + Context.Call = &*I; if ((++I)->getOpcode() != FrameDestroyOpcode) return; @@ -567,20 +567,20 @@ MachineInstr *X86CallFrameOptimization::canFoldIntoRegPush( if (!MRI->hasOneNonDBGUse(Reg)) return nullptr; - MachineBasicBlock::iterator DefMI = MRI->getVRegDef(Reg); + MachineInstr &DefMI = *MRI->getVRegDef(Reg); // Make sure the def is a MOV from memory. // If the def is in another block, give up. - if ((DefMI->getOpcode() != X86::MOV32rm && - DefMI->getOpcode() != X86::MOV64rm) || - DefMI->getParent() != FrameSetup->getParent()) + if ((DefMI.getOpcode() != X86::MOV32rm && + DefMI.getOpcode() != X86::MOV64rm) || + DefMI.getParent() != FrameSetup->getParent()) return nullptr; // Make sure we don't have any instructions between DefMI and the // push that make folding the load illegal. - for (auto I = DefMI; I != FrameSetup; ++I) + for (MachineBasicBlock::iterator I = DefMI; I != FrameSetup; ++I) if (I->isLoadFoldBarrier()) return nullptr; - return DefMI; + return &DefMI; } |