getExitBlocks(ExitBBs);
df_iterator_default_set<BlockT *> VisitSet;
VisitSet.insert(ExitBBs.begin(), ExitBBs.end());
- df_ext_iterator<BlockT *, df_iterator_default_set<BlockT *>>
- BI = df_ext_begin(getHeader(), VisitSet),
- BE = df_ext_end(getHeader(), VisitSet);
// Keep track of the BBs visited.
SmallPtrSet<BlockT *, 8> VisitedBBs;
// Check the individual blocks.
- for (; BI != BE; ++BI) {
- BlockT *BB = *BI;
-
+ for (BlockT *BB : depth_first_ext(getHeader(), VisitSet)) {
assert(std::any_of(GraphTraits<BlockT *>::child_begin(BB),
GraphTraits<BlockT *>::child_end(BB),
[&](BlockT *B) { return contains(B); }) &&
TTI::TargetCostKind CostKind) const {
// In the basic model, we just assume that all-constant GEPs will be folded
// into their uses via addressing modes.
- for (unsigned Idx = 0, Size = Operands.size(); Idx != Size; ++Idx)
- if (!isa<Constant>(Operands[Idx]))
+ for (const Value *Operand : Operands)
+ if (!isa<Constant>(Operand))
return TTI::TCC_Basic;
return TTI::TCC_Free;
if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
return &BlockInfoRecords.back();
- for (unsigned i = 0, e = static_cast<unsigned>(BlockInfoRecords.size());
- i != e; ++i)
- if (BlockInfoRecords[i].BlockID == BlockID)
- return &BlockInfoRecords[i];
+ for (const BlockInfo &BI : BlockInfoRecords)
+ if (BI.BlockID == BlockID)
+ return &BI;
return nullptr;
}
if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
return &BlockInfoRecords.back();
- for (unsigned i = 0, e = static_cast<unsigned>(BlockInfoRecords.size());
- i != e; ++i)
- if (BlockInfoRecords[i].BlockID == BlockID)
- return &BlockInfoRecords[i];
+ for (BlockInfo &BI : BlockInfoRecords)
+ if (BI.BlockID == BlockID)
+ return &BI;
return nullptr;
}
V.insert({GlobalValue::getGUID(Key), {std::string(Key), TId}});
}
static void output(IO &io, TypeIdSummaryMapTy &V) {
- for (auto TidIter = V.begin(); TidIter != V.end(); TidIter++)
- io.mapRequired(TidIter->second.first.c_str(), TidIter->second.second);
+ for (auto &TidIter : V)
+ io.mapRequired(TidIter.second.first.c_str(), TidIter.second.second);
}
};
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Obj.getData().data()));
std::lock_guard<sys::Mutex> locked(lock);
MemMgr->notifyObjectLoaded(this, Obj);
- for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
- EventListeners[I]->notifyObjectLoaded(Key, Obj, L);
- }
+ for (JITEventListener *EL : EventListeners)
+ EL->notifyObjectLoaded(Key, Obj, L);
}
void MCJIT::notifyFreeingObject(const object::ObjectFile &Obj) {
}
}
- for (unsigned I = 3; I < MI.getNumExplicitOperands(); ++I)
- MovDPP.addImm(MI.getOperand(I).getImm());
+ for (const MachineOperand &MO : llvm::drop_begin(MI.explicit_operands(), 3))
+ MovDPP.addImm(MO.getImm());
Split[Part] = MovDPP;
++Part;
// Depth-Diff[i]:
// Number of cycles saved in first 'i` iterations by optimizing the loop.
//===--------------------------------------------------------------------===//
- for (unsigned I = 0; I < LoopIterations; ++I) {
- DepthInfo &MaxDepth = LoopDepth[I];
+ for (DepthInfo &MaxDepth : LoopDepth) {
for (auto *MBB : Blocks) {
// Clear physical registers Def map.
RegDefMaps[PhyRegType].clear();
for (MachineInstr &MI : *LoopMBB) {
MI.setFlag(MachineInstr::FrameSetup);
}
- for (MachineBasicBlock::iterator CMBBI = ContinueMBB->begin();
- CMBBI != ContinueMBBI; ++CMBBI) {
- CMBBI->setFlag(MachineInstr::FrameSetup);
+ for (MachineInstr &MI :
+ llvm::make_range(ContinueMBB->begin(), ContinueMBBI)) {
+ MI.setFlag(MachineInstr::FrameSetup);
}
}
}
}
// Visit the children of this block in the dominator tree.
- for (auto I = Node->begin(), E = Node->end(); I != E; ++I) {
- Changed |= VisitNode(*I, TLSBaseAddrReg);
+ for (auto &I : *Node) {
+ Changed |= VisitNode(I, TLSBaseAddrReg);
}
return Changed;
bool YmmOrZmmUsed = FnHasLiveInYmmOrZmm;
for (auto *RC : {&X86::VR256RegClass, &X86::VR512_0_15RegClass}) {
if (!YmmOrZmmUsed) {
- for (TargetRegisterClass::iterator i = RC->begin(), e = RC->end(); i != e;
- i++) {
- if (!MRI.reg_nodbg_empty(*i)) {
+ for (MCPhysReg R : *RC) {
+ if (!MRI.reg_nodbg_empty(R)) {
YmmOrZmmUsed = true;
break;
}
case Type::StructTyID: {
StructType *STy = cast<StructType>(Ty);
if (STy->isOpaque()) return true;
- for (StructType::element_iterator I = STy->element_begin(),
- E = STy->element_end(); I != E; ++I) {
- Type *InnerTy = *I;
+ for (Type *InnerTy : STy->elements()) {
if (isa<PointerType>(InnerTy)) return true;
if (isa<StructType>(InnerTy) || isa<ArrayType>(InnerTy) ||
isa<VectorType>(InnerTy))