diff options
-rw-r--r-- | llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/XCore/XCoreISelLowering.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 11 |
7 files changed, 27 insertions, 34 deletions
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index ed4cfe3..f776cde 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -3394,8 +3394,8 @@ OpenMPIRBuilder::createOrderedDepend(const LocationDescription &Loc, 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)) diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index edf7bf5..c949c5f 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -9837,9 +9837,9 @@ static SDValue ReconstructTruncateFromBuildVector(SDValue V, SelectionDAG &DAG) 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 = diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp index 6723574..ae0329f 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp @@ -765,10 +765,9 @@ void MFMASmallGemmOpt::applyIGLPStrategy( 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; diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 8843bd8..1015399 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -13307,9 +13307,8 @@ static bool findConsecutiveLoad(LoadSDNode *LD, SelectionDAG &DAG) { 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(); @@ -15915,8 +15914,8 @@ Align PPCTargetLowering::getPrefLoopAlignment(MachineLoop *ML) const { // 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; } diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp index 70a1901..7585321 100644 --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -1383,23 +1383,21 @@ SDValue XCoreTargetLowering::LowerCCCArguments( // 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); } } diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 81f1fa1..9ab8014 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -1126,13 +1126,13 @@ SplitBlockPredecessorsImpl(BasicBlock *BB, ArrayRef<BasicBlock *> Preds, 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 @@ -1208,13 +1208,13 @@ static void SplitLandingPadPredecessorsImpl( 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; diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 0dab4f4..d61cb0b 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -831,8 +831,8 @@ static bool ValuesOverlap(std::vector<ValueEqualityComparisonCase> &C1, 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; } @@ -2825,11 +2825,8 @@ bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB, // 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; |