Identified with modernize-loop-convert.
InsertPointTy AllocaIP, unsigned NumLoops,
ArrayRef<llvm::Value *> StoreValues,
const Twine &Name, bool IsDependSource) {
- for (size_t I = 0; I < StoreValues.size(); I++)
- assert(StoreValues[I]->getType()->isIntegerTy(64) &&
+ for (const llvm::Value *SV : StoreValues)
+ assert(SV->getType()->isIntegerTy(64) &&
"OpenMP runtime requires depend vec with i64 type");
if (!updateToLocation(Loc))
SDValue Trunc[4] = {
V.getOperand(0).getOperand(0), V.getOperand(4).getOperand(0),
V.getOperand(8).getOperand(0), V.getOperand(12).getOperand(0)};
- for (int I = 0; I < 4; I++)
- if (Trunc[I].getValueType() == MVT::v4i32)
- Trunc[I] = DAG.getNode(ISD::TRUNCATE, DL, MVT::v4i16, Trunc[I]);
+ for (SDValue &V : Trunc)
+ if (V.getValueType() == MVT::v4i32)
+ V = DAG.getNode(ISD::TRUNCATE, DL, MVT::v4i16, V);
SDValue Concat0 =
DAG.getNode(ISD::CONCAT_VECTORS, DL, MVT::v8i16, Trunc[0], Trunc[1]);
SDValue Concat1 =
DenseMap<int, SmallVector<SchedGroup, 4>> &SyncedSchedGroups) {
// Count the number of MFMA instructions.
unsigned MFMACount = 0;
- for (auto I = DAG->begin(), E = DAG->end(); I != E; ++I) {
- if (TII->isMFMA(*I))
+ for (const MachineInstr &I : *DAG)
+ if (TII->isMFMA(I))
++MFMACount;
- }
const unsigned PipelineSyncID = 0;
SchedGroup *SG = nullptr;
Visited.clear();
Queue.clear();
- for (SmallSet<SDNode *, 16>::iterator I = LoadRoots.begin(),
- IE = LoadRoots.end(); I != IE; ++I) {
- Queue.push_back(*I);
+ for (SDNode *I : LoadRoots) {
+ Queue.push_back(I);
while (!Queue.empty()) {
SDNode *LoadRoot = Queue.pop_back_val();
// boundary so that the entire loop fits in one instruction-cache line.
uint64_t LoopSize = 0;
for (auto I = ML->block_begin(), IE = ML->block_end(); I != IE; ++I)
- for (auto J = (*I)->begin(), JE = (*I)->end(); J != JE; ++J) {
- LoopSize += TII->getInstSizeInBytes(*J);
+ for (const MachineInstr &J : **I) {
+ LoopSize += TII->getInstSizeInBytes(J);
if (LoopSize > 32)
break;
}
// Aggregates passed "byVal" need to be copied by the callee.
// The callee will use a pointer to this copy, rather than the original
// pointer.
- for (SmallVectorImpl<ArgDataPair>::const_iterator ArgDI = ArgData.begin(),
- ArgDE = ArgData.end();
- ArgDI != ArgDE; ++ArgDI) {
- if (ArgDI->Flags.isByVal() && ArgDI->Flags.getByValSize()) {
- unsigned Size = ArgDI->Flags.getByValSize();
+ for (const ArgDataPair &ArgDI : ArgData) {
+ if (ArgDI.Flags.isByVal() && ArgDI.Flags.getByValSize()) {
+ unsigned Size = ArgDI.Flags.getByValSize();
Align Alignment =
- std::max(Align(StackSlotSize), ArgDI->Flags.getNonZeroByValAlign());
+ std::max(Align(StackSlotSize), ArgDI.Flags.getNonZeroByValAlign());
// Create a new object on the stack and copy the pointee into it.
int FI = MFI.CreateStackObject(Size, Alignment, false);
SDValue FIN = DAG.getFrameIndex(FI, MVT::i32);
InVals.push_back(FIN);
MemOps.push_back(DAG.getMemcpy(
- Chain, dl, FIN, ArgDI->SDV, DAG.getConstant(Size, dl, MVT::i32),
+ Chain, dl, FIN, ArgDI.SDV, DAG.getConstant(Size, dl, MVT::i32),
Alignment, false, false, false, MachinePointerInfo(),
MachinePointerInfo()));
} else {
- InVals.push_back(ArgDI->SDV);
+ InVals.push_back(ArgDI.SDV);
}
}
BI->setDebugLoc(BB->getFirstNonPHIOrDbg()->getDebugLoc());
// Move the edges from Preds to point to NewBB instead of BB.
- for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
+ for (BasicBlock *Pred : Preds) {
// This is slightly more strict than necessary; the minimum requirement
// is that there be no more than one indirectbr branching to BB. And
// all BlockAddress uses would need to be updated.
- assert(!isa<IndirectBrInst>(Preds[i]->getTerminator()) &&
+ assert(!isa<IndirectBrInst>(Pred->getTerminator()) &&
"Cannot split an edge from an IndirectBrInst");
- Preds[i]->getTerminator()->replaceSuccessorWith(BB, NewBB);
+ Pred->getTerminator()->replaceSuccessorWith(BB, NewBB);
}
// Insert a new PHI node into NewBB for every PHI node in BB and that new PHI
BI1->setDebugLoc(OrigBB->getFirstNonPHI()->getDebugLoc());
// Move the edges from Preds to point to NewBB1 instead of OrigBB.
- for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
+ for (BasicBlock *Pred : Preds) {
// This is slightly more strict than necessary; the minimum requirement
// is that there be no more than one indirectbr branching to BB. And
// all BlockAddress uses would need to be updated.
- assert(!isa<IndirectBrInst>(Preds[i]->getTerminator()) &&
+ assert(!isa<IndirectBrInst>(Pred->getTerminator()) &&
"Cannot split an edge from an IndirectBrInst");
- Preds[i]->getTerminator()->replaceUsesOfWith(OrigBB, NewBB1);
+ Pred->getTerminator()->replaceUsesOfWith(OrigBB, NewBB1);
}
bool HasLoopExit = false;
if (V1->size() == 1) {
// Just scan V2.
ConstantInt *TheVal = (*V1)[0].Value;
- for (unsigned i = 0, e = V2->size(); i != e; ++i)
- if (TheVal == (*V2)[i].Value)
+ for (const ValueEqualityComparisonCase &VECC : *V2)
+ if (TheVal == VECC.Value)
return true;
}
// Consider any sink candidates which are only used in ThenBB as costs for
// speculation. Note, while we iterate over a DenseMap here, we are summing
// and so iteration order isn't significant.
- for (SmallDenseMap<Instruction *, unsigned, 4>::iterator
- I = SinkCandidateUseCounts.begin(),
- E = SinkCandidateUseCounts.end();
- I != E; ++I)
- if (I->first->hasNUses(I->second)) {
+ for (const auto &[Inst, Count] : SinkCandidateUseCounts)
+ if (Inst->hasNUses(Count)) {
++SpeculatedInstructions;
if (SpeculatedInstructions > 1)
return false;