forked from OSchip/llvm-project
SelectionDAG: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250214
This commit is contained in:
parent
02545feb2e
commit
e400a7d412
|
@ -118,9 +118,9 @@ bool FastISel::lowerArguments() {
|
|||
for (Function::const_arg_iterator I = FuncInfo.Fn->arg_begin(),
|
||||
E = FuncInfo.Fn->arg_end();
|
||||
I != E; ++I) {
|
||||
DenseMap<const Value *, unsigned>::iterator VI = LocalValueMap.find(I);
|
||||
DenseMap<const Value *, unsigned>::iterator VI = LocalValueMap.find(&*I);
|
||||
assert(VI != LocalValueMap.end() && "Missed an argument?");
|
||||
FuncInfo.ValueMap[I] = VI->second;
|
||||
FuncInfo.ValueMap[&*I] = VI->second;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
|||
|
||||
// Look for inline asm that clobbers the SP register.
|
||||
if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
|
||||
ImmutableCallSite CS(I);
|
||||
ImmutableCallSite CS(&*I);
|
||||
if (isa<InlineAsm>(CS.getCalledValue())) {
|
||||
unsigned SP = TLI->getStackPointerRegisterToSaveRestore();
|
||||
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
|
||||
|
@ -172,10 +172,9 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
|||
|
||||
// Mark values used outside their block as exported, by allocating
|
||||
// a virtual register for them.
|
||||
if (isUsedOutsideOfDefiningBlock(I))
|
||||
if (!isa<AllocaInst>(I) ||
|
||||
!StaticAllocaMap.count(cast<AllocaInst>(I)))
|
||||
InitializeRegForValue(I);
|
||||
if (isUsedOutsideOfDefiningBlock(&*I))
|
||||
if (!isa<AllocaInst>(I) || !StaticAllocaMap.count(cast<AllocaInst>(I)))
|
||||
InitializeRegForValue(&*I);
|
||||
|
||||
// Collect llvm.dbg.declare information. This is done now instead of
|
||||
// during the initial isel pass through the IR so that it is done
|
||||
|
@ -205,7 +204,7 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
|||
}
|
||||
|
||||
// Decide the preferred extend type for a value.
|
||||
PreferredExtendType[I] = getPreferredExtendForValue(I);
|
||||
PreferredExtendType[&*I] = getPreferredExtendForValue(&*I);
|
||||
}
|
||||
|
||||
// Create an initial MachineBasicBlock for each LLVM BasicBlock in F. This
|
||||
|
@ -229,8 +228,8 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
|||
assert(&*BB->begin() == I && "WinEHPrepare failed to demote PHIs");
|
||||
}
|
||||
|
||||
MachineBasicBlock *MBB = mf.CreateMachineBasicBlock(BB);
|
||||
MBBMap[BB] = MBB;
|
||||
MachineBasicBlock *MBB = mf.CreateMachineBasicBlock(&*BB);
|
||||
MBBMap[&*BB] = MBB;
|
||||
MF->push_back(MBB);
|
||||
|
||||
// Transfer the address-taken flag. This is necessary because there could
|
||||
|
@ -270,8 +269,8 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
|||
SmallVector<const LandingPadInst *, 4> LPads;
|
||||
for (BB = Fn->begin(); BB != EB; ++BB) {
|
||||
const Instruction *FNP = BB->getFirstNonPHI();
|
||||
if (BB->isEHPad() && MBBMap.count(BB))
|
||||
MBBMap[BB]->setIsEHPad();
|
||||
if (BB->isEHPad() && MBBMap.count(&*BB))
|
||||
MBBMap[&*BB]->setIsEHPad();
|
||||
if (const auto *LPI = dyn_cast<LandingPadInst>(FNP))
|
||||
LPads.push_back(LPI);
|
||||
}
|
||||
|
|
|
@ -4349,7 +4349,7 @@ void SelectionDAG::Legalize() {
|
|||
for (auto NI = allnodes_end(); NI != allnodes_begin();) {
|
||||
--NI;
|
||||
|
||||
SDNode *N = NI;
|
||||
SDNode *N = &*NI;
|
||||
if (N->use_empty() && N != getRoot().getNode()) {
|
||||
++NI;
|
||||
DeleteNode(N);
|
||||
|
|
|
@ -160,7 +160,7 @@ bool VectorLegalizer::Run() {
|
|||
DAG.AssignTopologicalOrder();
|
||||
for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
|
||||
E = std::prev(DAG.allnodes_end()); I != std::next(E); ++I)
|
||||
LegalizeOp(SDValue(I, 0));
|
||||
LegalizeOp(SDValue(&*I, 0));
|
||||
|
||||
// Finally, it's possible the root changed. Get the new root.
|
||||
SDValue OldRoot = DAG.getRoot();
|
||||
|
|
|
@ -949,7 +949,7 @@ void SelectionDAG::allnodes_clear() {
|
|||
assert(&*AllNodes.begin() == &EntryNode);
|
||||
AllNodes.remove(AllNodes.begin());
|
||||
while (!AllNodes.empty())
|
||||
DeallocateNode(AllNodes.begin());
|
||||
DeallocateNode(&AllNodes.front());
|
||||
#ifndef NDEBUG
|
||||
NextPersistentId = 0;
|
||||
#endif
|
||||
|
@ -6584,13 +6584,13 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
|||
// Node Id fields for nodes At SortedPos and after will contain the
|
||||
// count of outstanding operands.
|
||||
for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ) {
|
||||
SDNode *N = I++;
|
||||
SDNode *N = &*I++;
|
||||
checkForCycles(N, this);
|
||||
unsigned Degree = N->getNumOperands();
|
||||
if (Degree == 0) {
|
||||
// A node with no uses, add it to the result array immediately.
|
||||
N->setNodeId(DAGSize++);
|
||||
allnodes_iterator Q = N;
|
||||
allnodes_iterator Q(N);
|
||||
if (Q != SortedPos)
|
||||
SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q));
|
||||
assert(SortedPos != AllNodes.end() && "Overran node list");
|
||||
|
@ -6628,8 +6628,8 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
|||
}
|
||||
if (&Node == SortedPos) {
|
||||
#ifndef NDEBUG
|
||||
allnodes_iterator I = N;
|
||||
SDNode *S = ++I;
|
||||
allnodes_iterator I(N);
|
||||
SDNode *S = &*++I;
|
||||
dbgs() << "Overran sorted position:\n";
|
||||
S->dumprFull(this); dbgs() << "\n";
|
||||
dbgs() << "Checking if this is due to cycles\n";
|
||||
|
|
|
@ -1180,7 +1180,7 @@ void SelectionDAGBuilder::visitCatchPad(const CatchPadInst &I) {
|
|||
if (IsSEH) {
|
||||
DAG.setRoot(DAG.getNode(ISD::CATCHRET, getCurSDLoc(), MVT::Other,
|
||||
getControlRoot(), DAG.getBasicBlock(NormalDestMBB),
|
||||
DAG.getBasicBlock(FuncInfo.MF->begin())));
|
||||
DAG.getBasicBlock(&FuncInfo.MF->front())));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1587,7 +1587,7 @@ void SelectionDAGBuilder::FindMergedConditions(const Value *Cond,
|
|||
}
|
||||
|
||||
// Create TmpBB after CurBB.
|
||||
MachineFunction::iterator BBI = CurBB;
|
||||
MachineFunction::iterator BBI(CurBB);
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
MachineBasicBlock *TmpBB = MF.CreateMachineBasicBlock(CurBB->getBasicBlock());
|
||||
CurBB->getParent()->insert(++BBI, TmpBB);
|
||||
|
@ -7286,9 +7286,9 @@ static bool isOnlyUsedInEntryBlock(const Argument *A, bool FastISel) {
|
|||
if (FastISel)
|
||||
return A->use_empty();
|
||||
|
||||
const BasicBlock *Entry = A->getParent()->begin();
|
||||
const BasicBlock &Entry = A->getParent()->front();
|
||||
for (const User *U : A->users())
|
||||
if (cast<Instruction>(U)->getParent() != Entry || isa<SwitchInst>(U))
|
||||
if (cast<Instruction>(U)->getParent() != &Entry || isa<SwitchInst>(U))
|
||||
return false; // Use not in entry block.
|
||||
|
||||
return true;
|
||||
|
@ -7452,12 +7452,12 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
|
|||
// If this argument is unused then remember its value. It is used to generate
|
||||
// debugging information.
|
||||
if (I->use_empty() && NumValues) {
|
||||
SDB->setUnusedArgValue(I, InVals[i]);
|
||||
SDB->setUnusedArgValue(&*I, InVals[i]);
|
||||
|
||||
// Also remember any frame index for use in FastISel.
|
||||
if (FrameIndexSDNode *FI =
|
||||
dyn_cast<FrameIndexSDNode>(InVals[i].getNode()))
|
||||
FuncInfo->setArgumentFrameIndex(I, FI->getIndex());
|
||||
FuncInfo->setArgumentFrameIndex(&*I, FI->getIndex());
|
||||
}
|
||||
|
||||
for (unsigned Val = 0; Val != NumValues; ++Val) {
|
||||
|
@ -7487,18 +7487,18 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
|
|||
// Note down frame index.
|
||||
if (FrameIndexSDNode *FI =
|
||||
dyn_cast<FrameIndexSDNode>(ArgValues[0].getNode()))
|
||||
FuncInfo->setArgumentFrameIndex(I, FI->getIndex());
|
||||
FuncInfo->setArgumentFrameIndex(&*I, FI->getIndex());
|
||||
|
||||
SDValue Res = DAG.getMergeValues(makeArrayRef(ArgValues.data(), NumValues),
|
||||
SDB->getCurSDLoc());
|
||||
|
||||
SDB->setValue(I, Res);
|
||||
SDB->setValue(&*I, Res);
|
||||
if (!TM.Options.EnableFastISel && Res.getOpcode() == ISD::BUILD_PAIR) {
|
||||
if (LoadSDNode *LNode =
|
||||
dyn_cast<LoadSDNode>(Res.getOperand(0).getNode()))
|
||||
if (FrameIndexSDNode *FI =
|
||||
dyn_cast<FrameIndexSDNode>(LNode->getBasePtr().getNode()))
|
||||
FuncInfo->setArgumentFrameIndex(I, FI->getIndex());
|
||||
FuncInfo->setArgumentFrameIndex(&*I, FI->getIndex());
|
||||
}
|
||||
|
||||
// If this argument is live outside of the entry block, insert a copy from
|
||||
|
@ -7510,13 +7510,13 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
|
|||
// uses with vregs.
|
||||
unsigned Reg = cast<RegisterSDNode>(Res.getOperand(1))->getReg();
|
||||
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
||||
FuncInfo->ValueMap[I] = Reg;
|
||||
FuncInfo->ValueMap[&*I] = Reg;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!isOnlyUsedInEntryBlock(I, TM.Options.EnableFastISel)) {
|
||||
FuncInfo->InitializeRegForValue(I);
|
||||
SDB->CopyToExportRegsIfNeeded(I);
|
||||
if (!isOnlyUsedInEntryBlock(&*I, TM.Options.EnableFastISel)) {
|
||||
FuncInfo->InitializeRegForValue(&*I);
|
||||
SDB->CopyToExportRegsIfNeeded(&*I);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7618,7 +7618,7 @@ AddSuccessorMBB(const BasicBlock *BB,
|
|||
// If SuccBB has not been created yet, create it.
|
||||
if (!SuccMBB) {
|
||||
MachineFunction *MF = ParentMBB->getParent();
|
||||
MachineFunction::iterator BBI = ParentMBB;
|
||||
MachineFunction::iterator BBI(ParentMBB);
|
||||
SuccMBB = MF->CreateMachineBasicBlock(BB);
|
||||
MF->insert(++BBI, SuccMBB);
|
||||
}
|
||||
|
@ -7629,10 +7629,10 @@ AddSuccessorMBB(const BasicBlock *BB,
|
|||
}
|
||||
|
||||
MachineBasicBlock *SelectionDAGBuilder::NextBlock(MachineBasicBlock *MBB) {
|
||||
MachineFunction::iterator I = MBB;
|
||||
MachineFunction::iterator I(MBB);
|
||||
if (++I == FuncInfo.MF->end())
|
||||
return nullptr;
|
||||
return I;
|
||||
return &*I;
|
||||
}
|
||||
|
||||
/// During lowering new call nodes can be created (such as memset, etc.).
|
||||
|
@ -8096,9 +8096,9 @@ void SelectionDAGBuilder::lowerWorkItem(SwitchWorkListItem W, Value *Cond,
|
|||
MachineBasicBlock *DefaultMBB) {
|
||||
MachineFunction *CurMF = FuncInfo.MF;
|
||||
MachineBasicBlock *NextMBB = nullptr;
|
||||
MachineFunction::iterator BBI = W.MBB;
|
||||
MachineFunction::iterator BBI(W.MBB);
|
||||
if (++BBI != FuncInfo.MF->end())
|
||||
NextMBB = BBI;
|
||||
NextMBB = &*BBI;
|
||||
|
||||
unsigned Size = W.LastCluster - W.FirstCluster + 1;
|
||||
|
||||
|
@ -8400,7 +8400,7 @@ void SelectionDAGBuilder::splitWorkItem(SwitchWorkList &WorkList,
|
|||
const ConstantInt *Pivot = PivotCluster->Low;
|
||||
|
||||
// New blocks will be inserted immediately after the current one.
|
||||
MachineFunction::iterator BBI = W.MBB;
|
||||
MachineFunction::iterator BBI(W.MBB);
|
||||
++BBI;
|
||||
|
||||
// We will branch to the LHS if Value < Pivot. If LHS is a single cluster,
|
||||
|
|
|
@ -604,7 +604,7 @@ void SelectionDAG::dump() const {
|
|||
|
||||
for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end();
|
||||
I != E; ++I) {
|
||||
const SDNode *N = I;
|
||||
const SDNode *N = &*I;
|
||||
if (!N->hasOneUse() && N != getRoot().getNode() &&
|
||||
(!shouldPrintInline(*N) || N->use_empty()))
|
||||
DumpNodes(N, 2, this);
|
||||
|
|
|
@ -388,8 +388,8 @@ void SelectionDAGISel::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||
///
|
||||
static void SplitCriticalSideEffectEdges(Function &Fn) {
|
||||
// Loop for blocks with phi nodes.
|
||||
for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {
|
||||
PHINode *PN = dyn_cast<PHINode>(BB->begin());
|
||||
for (BasicBlock &BB : Fn) {
|
||||
PHINode *PN = dyn_cast<PHINode>(BB.begin());
|
||||
if (!PN) continue;
|
||||
|
||||
ReprocessBlock:
|
||||
|
@ -397,7 +397,7 @@ static void SplitCriticalSideEffectEdges(Function &Fn) {
|
|||
// are potentially trapping constant expressions. Constant expressions are
|
||||
// the only potentially trapping value that can occur as the argument to a
|
||||
// PHI.
|
||||
for (BasicBlock::iterator I = BB->begin(); (PN = dyn_cast<PHINode>(I)); ++I)
|
||||
for (BasicBlock::iterator I = BB.begin(); (PN = dyn_cast<PHINode>(I)); ++I)
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
|
||||
ConstantExpr *CE = dyn_cast<ConstantExpr>(PN->getIncomingValue(i));
|
||||
if (!CE || !CE->canTrap()) continue;
|
||||
|
@ -411,7 +411,7 @@ static void SplitCriticalSideEffectEdges(Function &Fn) {
|
|||
|
||||
// Okay, we have to split this edge.
|
||||
SplitCriticalEdge(
|
||||
Pred->getTerminator(), GetSuccessorNumber(Pred, BB),
|
||||
Pred->getTerminator(), GetSuccessorNumber(Pred, &BB),
|
||||
CriticalEdgeSplittingOptions().setMergeIdenticalEdges());
|
||||
goto ReprocessBlock;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
|||
// If the first basic block in the function has live ins that need to be
|
||||
// copied into vregs, emit the copies into the top of the block before
|
||||
// emitting the code for the block.
|
||||
MachineBasicBlock *EntryMBB = MF->begin();
|
||||
MachineBasicBlock *EntryMBB = &MF->front();
|
||||
const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo();
|
||||
RegInfo->EmitLiveInCopies(EntryMBB, TRI, *TII);
|
||||
|
||||
|
@ -888,7 +888,7 @@ void SelectionDAGISel::DoInstructionSelection() {
|
|||
// graph) and preceding back toward the beginning (the entry
|
||||
// node).
|
||||
while (ISelPosition != CurDAG->allnodes_begin()) {
|
||||
SDNode *Node = --ISelPosition;
|
||||
SDNode *Node = &*--ISelPosition;
|
||||
// Skip dead nodes. DAGCombiner is expected to eliminate all dead nodes,
|
||||
// but there are currently some corner cases that it misses. Also, this
|
||||
// makes it theoretically possible to disable the DAGCombiner.
|
||||
|
@ -1141,7 +1141,8 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
FuncInfo->VisitedBBs.insert(LLVMBB);
|
||||
}
|
||||
|
||||
BasicBlock::const_iterator const Begin = LLVMBB->getFirstNonPHI();
|
||||
BasicBlock::const_iterator const Begin =
|
||||
LLVMBB->getFirstNonPHI()->getIterator();
|
||||
BasicBlock::const_iterator const End = LLVMBB->end();
|
||||
BasicBlock::const_iterator BI = End;
|
||||
|
||||
|
@ -1192,7 +1193,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
unsigned NumFastIselRemaining = std::distance(Begin, End);
|
||||
// Do FastISel on as many instructions as possible.
|
||||
for (; BI != Begin; --BI) {
|
||||
const Instruction *Inst = std::prev(BI);
|
||||
const Instruction *Inst = &*std::prev(BI);
|
||||
|
||||
// If we no longer require this instruction, skip it.
|
||||
if (isFoldedOrDeadInstruction(Inst, FuncInfo)) {
|
||||
|
@ -1212,8 +1213,8 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
// then see if there is a load right before the selected instructions.
|
||||
// Try to fold the load if so.
|
||||
const Instruction *BeforeInst = Inst;
|
||||
while (BeforeInst != Begin) {
|
||||
BeforeInst = std::prev(BasicBlock::const_iterator(BeforeInst));
|
||||
while (BeforeInst != &*Begin) {
|
||||
BeforeInst = &*std::prev(BasicBlock::const_iterator(BeforeInst));
|
||||
if (!isFoldedOrDeadInstruction(BeforeInst, FuncInfo))
|
||||
break;
|
||||
}
|
||||
|
@ -1254,7 +1255,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
|
||||
bool HadTailCall = false;
|
||||
MachineBasicBlock::iterator SavedInsertPt = FuncInfo->InsertPt;
|
||||
SelectBasicBlock(Inst, BI, HadTailCall);
|
||||
SelectBasicBlock(Inst->getIterator(), BI, HadTailCall);
|
||||
|
||||
// If the call was emitted as a tail call, we're done with the block.
|
||||
// We also need to delete any previously emitted instructions.
|
||||
|
|
Loading…
Reference in New Issue