[llvm] r249880 - CodeGen: Avoid ilist iterator implicit conversions in a few more places, NFC
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 12:23:21 PDT 2015
Author: dexonsmith
Date: Fri Oct 9 14:23:20 2015
New Revision: 249880
URL: http://llvm.org/viewvc/llvm-project?rev=249880&view=rev
Log:
CodeGen: Avoid ilist iterator implicit conversions in a few more places, NFC
Modified:
llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h?rev=249880&r1=249879&r2=249880&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h Fri Oct 9 14:23:20 2015
@@ -966,7 +966,7 @@ void BlockFrequencyInfoImpl<BT>::calcula
}
template <class BT> void BlockFrequencyInfoImpl<BT>::initializeRPOT() {
- const BlockT *Entry = F->begin();
+ const BlockT *Entry = &F->front();
RPOT.reserve(F->size());
std::copy(po_begin(Entry), po_end(Entry), std::back_inserter(RPOT));
std::reverse(RPOT.begin(), RPOT.end());
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=249880&r1=249879&r2=249880&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Fri Oct 9 14:23:20 2015
@@ -302,8 +302,8 @@ void MachineBasicBlock::print(raw_ostrea
for (const_instr_iterator I = instr_begin(); I != instr_end(); ++I) {
if (Indexes) {
- if (Indexes->hasIndex(I))
- OS << Indexes->getInstructionIndex(I);
+ if (Indexes->hasIndex(&*I))
+ OS << Indexes->getInstructionIndex(&*I);
OS << '\t';
}
OS << '\t';
@@ -402,12 +402,11 @@ MachineBasicBlock::addLiveIn(MCPhysReg P
}
void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) {
- getParent()->splice(NewAfter, this);
+ getParent()->splice(NewAfter->getIterator(), getIterator());
}
void MachineBasicBlock::moveAfter(MachineBasicBlock *NewBefore) {
- MachineFunction::iterator BBI = NewBefore;
- getParent()->splice(++BBI, this);
+ getParent()->splice(++NewBefore->getIterator(), getIterator());
}
void MachineBasicBlock::updateTerminator() {
@@ -653,14 +652,14 @@ bool MachineBasicBlock::isLayoutSuccesso
}
bool MachineBasicBlock::canFallThrough() {
- MachineFunction::iterator Fallthrough = this;
+ MachineFunction::iterator Fallthrough = getIterator();
++Fallthrough;
// If FallthroughBlock is off the end of the function, it can't fall through.
if (Fallthrough == getParent()->end())
return false;
// If FallthroughBlock isn't a successor, no fallthrough is possible.
- if (!isSuccessor(Fallthrough))
+ if (!isSuccessor(&*Fallthrough))
return false;
// Analyze the branches, if any, at the end of the block.
@@ -751,7 +750,7 @@ MachineBasicBlock::SplitCriticalEdge(Mac
if (LV)
for (instr_iterator I = getFirstInstrTerminator(), E = instr_end();
I != E; ++I) {
- MachineInstr *MI = I;
+ MachineInstr *MI = &*I;
for (MachineInstr::mop_iterator OI = MI->operands_begin(),
OE = MI->operands_end(); OI != OE; ++OI) {
if (!OI->isReg() || OI->getReg() == 0 ||
@@ -771,7 +770,7 @@ MachineBasicBlock::SplitCriticalEdge(Mac
if (LIS) {
for (instr_iterator I = getFirstInstrTerminator(), E = instr_end();
I != E; ++I) {
- MachineInstr *MI = I;
+ MachineInstr *MI = &*I;
for (MachineInstr::mop_iterator OI = MI->operands_begin(),
OE = MI->operands_end(); OI != OE; ++OI) {
@@ -793,7 +792,7 @@ MachineBasicBlock::SplitCriticalEdge(Mac
if (Indexes) {
for (instr_iterator I = getFirstInstrTerminator(), E = instr_end();
I != E; ++I)
- Terminators.push_back(I);
+ Terminators.push_back(&*I);
}
updateTerminator();
@@ -802,7 +801,7 @@ MachineBasicBlock::SplitCriticalEdge(Mac
SmallVector<MachineInstr*, 4> NewTerminators;
for (instr_iterator I = getFirstInstrTerminator(), E = instr_end();
I != E; ++I)
- NewTerminators.push_back(I);
+ NewTerminators.push_back(&*I);
for (SmallVectorImpl<MachineInstr*>::iterator I = Terminators.begin(),
E = Terminators.end(); I != E; ++I) {
@@ -823,9 +822,9 @@ MachineBasicBlock::SplitCriticalEdge(Mac
I != E; ++I) {
// Some instructions may have been moved to NMBB by updateTerminator(),
// so we first remove any instruction that already has an index.
- if (Indexes->hasIndex(I))
- Indexes->removeMachineInstrFromMaps(I);
- Indexes->insertMachineInstrInMaps(I);
+ if (Indexes->hasIndex(&*I))
+ Indexes->removeMachineInstrFromMaps(&*I);
+ Indexes->insertMachineInstrInMaps(&*I);
}
}
}
@@ -852,7 +851,7 @@ MachineBasicBlock::SplitCriticalEdge(Mac
if (!(--I)->addRegisterKilled(Reg, TRI, /* addIfNotFound= */ false))
continue;
if (TargetRegisterInfo::isVirtualRegister(Reg))
- LV->getVarInfo(Reg).Kills.push_back(I);
+ LV->getVarInfo(Reg).Kills.push_back(&*I);
DEBUG(dbgs() << "Restored terminator kill: " << *I);
break;
}
@@ -972,7 +971,7 @@ static void unbundleSingleMI(MachineInst
MachineBasicBlock::instr_iterator
MachineBasicBlock::erase(MachineBasicBlock::instr_iterator I) {
- unbundleSingleMI(I);
+ unbundleSingleMI(&*I);
return Insts.erase(I);
}
@@ -1058,17 +1057,16 @@ bool MachineBasicBlock::CorrectExtraCFGE
bool Changed = false;
- MachineFunction::iterator FallThru =
- std::next(MachineFunction::iterator(this));
+ MachineFunction::iterator FallThru = std::next(getIterator());
if (!DestA && !DestB) {
// Block falls through to successor.
- DestA = FallThru;
- DestB = FallThru;
+ DestA = &*FallThru;
+ DestB = &*FallThru;
} else if (DestA && !DestB) {
if (IsCond)
// Block ends in conditional jump that falls through to successor.
- DestB = FallThru;
+ DestB = &*FallThru;
} else {
assert(DestA && DestB && IsCond &&
"CFG in a bad state. Cannot correct CFG edges");
Modified: llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp?rev=249880&r1=249879&r2=249880&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp Fri Oct 9 14:23:20 2015
@@ -57,7 +57,7 @@ struct GraphTraits<MachineBlockFrequency
static inline
const NodeType *getEntryNode(const MachineBlockFrequencyInfo *G) {
- return G->getFunction()->begin();
+ return &G->getFunction()->front();
}
static ChildIteratorType child_begin(const NodeType *N) {
More information about the llvm-commits
mailing list