diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index efbc950496b69..fdbed1b62fdcd 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -977,7 +977,7 @@ bool IRPosition::getAttrsFromAssumes(Attribute::AttrKind AK, MustBeExecutedContextExplorer &Explorer = A.getInfoCache().getMustBeExecutedContextExplorer(); auto EIt = Explorer.begin(getCtxI()), EEnd = Explorer.end(getCtxI()); - for (auto &It : A2K) + for (const auto &It : A2K) if (Explorer.findInContextOf(It.first, EIt, EEnd)) Attrs.push_back(Attribute::get(Ctx, AK, It.second.Max)); return AttrsSize != Attrs.size(); @@ -1113,7 +1113,7 @@ bool Attributor::getAssumedSimplifiedValues( // a non-null value that is different from the associated value, or None, we // assume it's simplified. const auto &SimplificationCBs = SimplificationCallbacks.lookup(IRP); - for (auto &CB : SimplificationCBs) { + for (const auto &CB : SimplificationCBs) { Optional CBResult = CB(IRP, AA, UsedAssumedInformation); if (!CBResult.has_value()) continue; @@ -2079,7 +2079,7 @@ ChangeStatus Attributor::cleanupIR() { } } - for (auto &V : InvokeWithDeadSuccessor) + for (const auto &V : InvokeWithDeadSuccessor) if (InvokeInst *II = dyn_cast_or_null(V)) { assert(isRunOn(*II->getFunction()) && "Cannot replace an invoke outside the current SCC!"); @@ -2112,7 +2112,7 @@ ChangeStatus Attributor::cleanupIR() { CGModifiedFunctions.insert(I->getFunction()); ConstantFoldTerminator(I->getParent()); } - for (auto &V : ToBeChangedToUnreachableInsts) + for (const auto &V : ToBeChangedToUnreachableInsts) if (Instruction *I = dyn_cast_or_null(V)) { LLVM_DEBUG(dbgs() << "[Attributor] Change to unreachable: " << *I << "\n"); @@ -2122,7 +2122,7 @@ ChangeStatus Attributor::cleanupIR() { changeToUnreachable(I); } - for (auto &V : ToBeDeletedInsts) { + for (const auto &V : ToBeDeletedInsts) { if (Instruction *I = dyn_cast_or_null(V)) { if (auto *CB = dyn_cast(I)) { assert(isRunOn(*I->getFunction()) && @@ -3190,7 +3190,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, if (!S.isValidState()) OS << "full-set"; else { - for (auto &It : S.getAssumedSet()) + for (const auto &It : S.getAssumedSet()) OS << It << ", "; if (S.undefIsContained()) OS << "undef "; @@ -3206,7 +3206,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, if (!S.isValidState()) OS << "full-set"; else { - for (auto &It : S.getAssumedSet()) { + for (const auto &It : S.getAssumedSet()) { if (auto *F = dyn_cast(It.first.getValue())) OS << "@" << F->getName() << "[" << int(It.second) << "], "; else diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index fa4e33a820edd..cf64ff5885f2f 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -891,7 +891,7 @@ struct AA::PointerInfo::State : public AbstractState { if (!isValidState()) return false; - for (auto &It : AccessBins) { + for (const auto &It : AccessBins) { AAPointerInfo::OffsetAndSize ItOAS = It.getFirst(); if (!OAS.mayOverlap(ItOAS)) continue; @@ -912,7 +912,7 @@ struct AA::PointerInfo::State : public AbstractState { // First find the offset and size of I. AAPointerInfo::OffsetAndSize OAS(-1, -1); - for (auto &It : AccessBins) { + for (const auto &It : AccessBins) { for (auto &Access : *It.getSecond()) { if (Access.getRemoteInst() == &I) { OAS = It.getFirst(); @@ -1148,7 +1148,7 @@ struct AAPointerInfoImpl // Combine the accesses bin by bin. ChangeStatus Changed = ChangeStatus::UNCHANGED; - for (auto &It : OtherAAImpl.getState()) { + for (const auto &It : OtherAAImpl.getState()) { OffsetAndSize OAS = OffsetAndSize::getUnknown(); if (Offset != OffsetAndSize::Unknown) OAS = OffsetAndSize(It.first.getOffset() + Offset, It.first.getSize()); @@ -1802,7 +1802,7 @@ bool AAReturnedValuesImpl::checkForAllReturnedValuesAndReturnInsts( // Check all returned values but ignore call sites as long as we have not // encountered an overdefined one during an update. - for (auto &It : ReturnedValues) { + for (const auto &It : ReturnedValues) { Value *RV = It.first; if (!Pred(*RV, It.second)) return false; @@ -3977,7 +3977,7 @@ identifyAliveSuccessors(Attributor &A, const SwitchInst &SI, if (!C || isa_and_nonnull(C.value())) { // No value yet, assume all edges are dead. } else if (isa_and_nonnull(C.value())) { - for (auto &CaseIt : SI.cases()) { + for (const auto &CaseIt : SI.cases()) { if (CaseIt.getCaseValue() == C.value()) { AliveSuccessors.push_back(&CaseIt.getCaseSuccessor()->front()); return UsedAssumedInformation; @@ -5141,7 +5141,7 @@ ChangeStatus AANoCaptureImpl::updateImpl(Attributor &A) { if (!RVAA.getState().isValidState()) return false; bool SeenConstant = false; - for (auto &It : RVAA.returned_values()) { + for (const auto &It : RVAA.returned_values()) { if (isa(It.first)) { if (SeenConstant) return false; @@ -5902,7 +5902,7 @@ struct AAHeapToStackFunction final : public AAHeapToStack { STATS_DECL( MallocCalls, Function, "Number of malloc/calloc/aligned_alloc calls converted to allocas"); - for (auto &It : AllocationInfos) + for (const auto &It : AllocationInfos) if (It.second->Status != AllocationInfo::INVALID) ++BUILD_STAT_NAME(MallocCalls, Function); } @@ -5919,7 +5919,7 @@ struct AAHeapToStackFunction final : public AAHeapToStack { if (!isValidState()) return false; - for (auto &It : AllocationInfos) { + for (const auto &It : AllocationInfos) { AllocationInfo &AI = *It.second; if (AI.Status == AllocationInfo::INVALID) continue; @@ -8980,7 +8980,7 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { if (Undef) unionAssumedWithUndef(); else { - for (auto &It : *OpAA) + for (const auto &It : *OpAA) unionAssumed(It); } @@ -8988,9 +8988,9 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { // select i1 *, undef , undef => undef unionAssumedWithUndef(); } else { - for (auto &It : LHSAAPVS) + for (const auto &It : LHSAAPVS) unionAssumed(It); - for (auto &It : RHSAAPVS) + for (const auto &It : RHSAAPVS) unionAssumed(It); } return AssumedBefore == getAssumed() ? ChangeStatus::UNCHANGED @@ -9416,7 +9416,7 @@ struct AACallEdgesCallSite : public AACallEdgesImpl { // Process callee metadata if available. if (auto *MD = getCtxI()->getMetadata(LLVMContext::MD_callees)) { - for (auto &Op : MD->operands()) { + for (const auto &Op : MD->operands()) { Function *Callee = mdconst::dyn_extract_or_null(Op); if (Callee) addCalledFunction(Callee, Change); @@ -9571,7 +9571,7 @@ struct AAFunctionReachabilityFunction : public AAFunctionReachability { } SmallVector Deps; - for (auto &AAEdges : AAEdgesList) { + for (const auto &AAEdges : AAEdgesList) { const SetVector &Edges = AAEdges->getOptimisticEdges(); for (Function *Edge : Edges) { @@ -9851,7 +9851,7 @@ struct AAPotentialValuesImpl : AAPotentialValues { IRPosition ValIRP = IRPosition::value(V); if (auto *CB = dyn_cast_or_null(CtxI)) { - for (auto &U : CB->args()) { + for (const auto &U : CB->args()) { if (U.get() != &V) continue; ValIRP = IRPosition::callsite_argument(*CB, CB->getArgOperandNo(&U)); @@ -9868,7 +9868,7 @@ struct AAPotentialValuesImpl : AAPotentialValues { auto &PotentialConstantsAA = A.getAAFor( *this, ValIRP, DepClassTy::OPTIONAL); if (PotentialConstantsAA.isValidState()) { - for (auto &It : PotentialConstantsAA.getAssumedSet()) + for (const auto &It : PotentialConstantsAA.getAssumedSet()) State.unionAssumed({{*ConstantInt::get(&Ty, It), nullptr}, S}); if (PotentialConstantsAA.undefIsContained()) State.unionAssumed({{*UndefValue::get(&Ty), nullptr}, S}); @@ -9930,7 +9930,7 @@ struct AAPotentialValuesImpl : AAPotentialValues { void giveUpOnIntraprocedural(Attributor &A) { auto NewS = StateType::getBestState(getState()); - for (auto &It : getAssumedSet()) { + for (const auto &It : getAssumedSet()) { if (It.second == AA::Intraprocedural) continue; addValue(A, NewS, *It.first.getValue(), It.first.getCtxI(), @@ -9982,7 +9982,7 @@ struct AAPotentialValuesImpl : AAPotentialValues { AA::ValueScope S) const override { if (!isValidState()) return false; - for (auto &It : getAssumedSet()) + for (const auto &It : getAssumedSet()) if (It.second & S) Values.push_back(It.first); assert(!undefIsContained() && "Undef should be an explicit value!"); diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index 399dc00a2a279..73ebb27b59621 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -517,7 +517,7 @@ bool llvm::thinLTOPropagateFunctionAttrs( ++NumThinLinkNoUnwind; } - for (auto &S : V.getSummaryList()) { + for (const auto &S : V.getSummaryList()) { if (auto *FS = dyn_cast(S.get())) { if (InferredFlags.NoRecurse) FS->setNoRecurse(); diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 1fd8133550b42..a7665f50a5eee 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -2397,7 +2397,7 @@ static bool cxxDtorIsEmpty(const Function &Fn) { if (Fn.isDeclaration()) return false; - for (auto &I : Fn.getEntryBlock()) { + for (const auto &I : Fn.getEntryBlock()) { if (I.isDebugOrPseudoInst()) continue; if (isa(I)) diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index e3e4908f085bc..69f7aba8b9be1 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -539,7 +539,7 @@ BitSetInfo LowerTypeTestsModule::buildBitSet( // Compute the byte offset of each address associated with this type // identifier. - for (auto &GlobalAndOffset : GlobalLayout) { + for (const auto &GlobalAndOffset : GlobalLayout) { for (MDNode *Type : GlobalAndOffset.first->types()) { if (Type->getOperand(1) != TypeId) continue; @@ -1912,7 +1912,7 @@ bool LowerTypeTestsModule::lower() { for (auto &I : *ExportSummary) for (auto &GVS : I.second.SummaryList) if (GVS->isLive()) - for (auto &Ref : GVS->refs()) + for (const auto &Ref : GVS->refs()) AddressTaken.insert(Ref.getGUID()); NamedMDNode *CfiFunctionsMD = M.getNamedMetadata("cfi.functions"); @@ -1938,7 +1938,7 @@ bool LowerTypeTestsModule::lower() { bool Exported = false; if (auto VI = ExportSummary->getValueInfo(GUID)) - for (auto &GVS : VI.getSummaryList()) + for (const auto &GVS : VI.getSummaryList()) if (GVS->isLive() && !GlobalValue::isLocalLinkage(GVS->linkage())) Exported = true; diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index bec390ef37552..92cb7bd7976e7 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -363,7 +363,7 @@ class GUIDToFuncNameMapper { FS->GUIDToFuncNameMap = Map; for (const auto &ICS : FS->getCallsiteSamples()) { const FunctionSamplesMap &FSMap = ICS.second; - for (auto &IFS : FSMap) { + for (const auto &IFS : FSMap) { FunctionSamples &FS = const_cast(IFS.second); FSToUpdate.push(&FS); } diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index 18efe99f7cb48..6b50239463418 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -387,7 +387,7 @@ bool mustBeUnreachableFunction(ValueInfo TheFnVI) { return false; } - for (auto &Summary : TheFnVI.getSummaryList()) { + for (const auto &Summary : TheFnVI.getSummaryList()) { // Conservatively returns false if any non-live functions are seen. // In general either all summaries should be live or all should be dead. if (!Summary->isLive()) @@ -1048,7 +1048,7 @@ bool DevirtIndex::tryFindVirtualCallTargets( // conservatively return false early. const GlobalVarSummary *VS = nullptr; bool LocalFound = false; - for (auto &S : P.VTableVI.getSummaryList()) { + for (const auto &S : P.VTableVI.getSummaryList()) { if (GlobalValue::isLocalLinkage(S->linkage())) { if (LocalFound) return false; @@ -1278,7 +1278,7 @@ bool DevirtIndex::trySingleImplDevirt(MutableArrayRef TargetsForSlot, // If the summary list contains multiple summaries where at least one is // a local, give up, as we won't know which (possibly promoted) name to use. - for (auto &S : TheFn.getSummaryList()) + for (const auto &S : TheFn.getSummaryList()) if (GlobalValue::isLocalLinkage(S->linkage()) && Size > 1) return false; @@ -2309,7 +2309,7 @@ void DevirtIndex::run() { return; DenseMap> NameByGUID; - for (auto &P : ExportSummary.typeIdCompatibleVtableMap()) { + for (const auto &P : ExportSummary.typeIdCompatibleVtableMap()) { NameByGUID[GlobalValue::getGUID(P.first)].push_back(P.first); } diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index dd03f98c5be78..de551e049035d 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3218,7 +3218,7 @@ Instruction *InstCombinerImpl::visitSwitchInst(SwitchInst &SI) { // Compute the number of leading bits we can ignore. // TODO: A better way to determine this would use ComputeNumSignBits(). - for (auto &C : SI.cases()) { + for (const auto &C : SI.cases()) { LeadingKnownZeros = std::min( LeadingKnownZeros, C.getCaseValue()->getValue().countLeadingZeros()); LeadingKnownOnes = std::min( @@ -4377,7 +4377,7 @@ class AliasScopeTracker { const auto *MDScopeList = dyn_cast_or_null(ScopeList); if (!MDScopeList || !Container.insert(MDScopeList).second) return; - for (auto &MDOperand : MDScopeList->operands()) + for (const auto &MDOperand : MDScopeList->operands()) if (auto *MDScope = dyn_cast(MDOperand)) Container.insert(MDScope); }; diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index b856772b13a86..ca3c4ba578df4 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -992,7 +992,7 @@ struct UseBBInfo : public BBInfo { // Sum up the count values for all the edges. static uint64_t sumEdgeCount(const ArrayRef Edges) { uint64_t Total = 0; - for (auto &E : Edges) { + for (const auto &E : Edges) { if (E->Removed) continue; Total += E->CountValue; @@ -1204,7 +1204,7 @@ static void annotateFunctionWithHashMismatch(Function &F, auto *Existing = F.getMetadata(LLVMContext::MD_annotation); if (Existing) { MDTuple *Tuple = cast(Existing); - for (auto &N : Tuple->operands()) { + for (const auto &N : Tuple->operands()) { if (cast(N.get())->getString() == MetadataName) return; Names.push_back(N.get()); diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index da360acbbb378..5044d47fd37c5 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -1503,7 +1503,7 @@ static void collectReleaseInsertPts( const BlotMapVector &Retains, DenseMap> &ReleaseInsertPtToRCIdentityRoots) { - for (auto &P : Retains) { + for (const auto &P : Retains) { // Retains is a map from an objc_retain call to a RRInfo of the RC identity // root of the call. Get the RC identity root of the objc_retain call. Instruction *Retain = cast(P.first); diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index cdf9de8d78d52..1c1f838252a99 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/lib/Transforms/Scalar/ADCE.cpp @@ -295,7 +295,7 @@ void AggressiveDeadCodeElimination::initialize() { // return of the function. // We do this by seeing which of the postdomtree root children exit the // program, and for all others, mark the subtree live. - for (auto &PDTChild : children(PDT.getRootNode())) { + for (const auto &PDTChild : children(PDT.getRootNode())) { auto *BB = PDTChild->getBlock(); auto &Info = BlockInfo[BB]; // Real function return diff --git a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp index cc12033fb6774..310188de280a8 100644 --- a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp +++ b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp @@ -165,7 +165,7 @@ static void recordConditions(CallBase &CB, BasicBlock *Pred, } static void addConditions(CallBase &CB, const ConditionsTy &Conditions) { - for (auto &Cond : Conditions) { + for (const auto &Cond : Conditions) { Value *Arg = Cond.first->getOperand(0); Constant *ConstVal = cast(Cond.first->getOperand(1)); if (Cond.second == ICmpInst::ICMP_EQ) diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index afff8a8cfea1d..fd8e4890f4541 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1900,7 +1900,7 @@ bool GVNPass::processAssumeIntrinsic(AssumeInst *IntrinsicI) { // after the found access or before the terminator if no such access is // found. if (AL) { - for (auto &Acc : *AL) { + for (const auto &Acc : *AL) { if (auto *Current = dyn_cast(&Acc)) if (!Current->getMemoryInst()->comesBefore(NewS)) { FirstNonDom = Current; diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 6cdc671ddb649..5960dffa65ec4 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -435,7 +435,7 @@ class GVNHoist { continue; const VNType &VN = R; SmallPtrSet VNBlocks; - for (auto &I : V) { + for (const auto &I : V) { BasicBlock *BBI = I->getParent(); if (!hasEH(BBI)) VNBlocks.insert(BBI); @@ -563,7 +563,7 @@ bool GVNHoist::run(Function &F) { for (const BasicBlock *BB : depth_first(&F.getEntryBlock())) { DFSNumber[BB] = ++BBI; unsigned I = 0; - for (auto &Inst : *BB) + for (const auto &Inst : *BB) DFSNumber[&Inst] = ++I; } diff --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp index 93f3cd704196c..bf5c1f4b9a67b 100644 --- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp @@ -106,7 +106,7 @@ static bool isLoopDead(Loop *L, ScalarEvolution &SE, // Make sure that no instructions in the block have potential side-effects. // This includes instructions that could write to memory, and loads that are // marked volatile. - for (auto &I : L->blocks()) + for (const auto &I : L->blocks()) if (any_of(*I, [](Instruction &I) { return I.mayHaveSideEffects() && !I.isDroppable(); })) diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp index 9cf7ee2f6a364..f7f74675b290f 100644 --- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp @@ -633,7 +633,7 @@ class MemoryInstructionDependences { Accesses.append(Instructions.begin(), Instructions.end()); LLVM_DEBUG(dbgs() << "Backward dependences:\n"); - for (auto &Dep : Dependences) + for (const auto &Dep : Dependences) if (Dep.isPossiblyBackward()) { // Note that the designations source and destination follow the program // order, i.e. source is always first. (The direction is given by the @@ -715,7 +715,7 @@ class LoopDistributeForLoop { *Dependences); int NumUnsafeDependencesActive = 0; - for (auto &InstDep : MID) { + for (const auto &InstDep : MID) { Instruction *I = InstDep.Inst; // We update NumUnsafeDependencesActive post-instruction, catch the // start of a dependence directly via NumUnsafeDependencesStartOrEnd. diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 0a17b777797ec..c3033070a0d46 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -5980,7 +5980,7 @@ struct SCEVDbgValueBuilder { "Expected arithmetic SCEV type"); bool Success = true; unsigned EmitOperator = 0; - for (auto &Op : CommExpr->operands()) { + for (const auto &Op : CommExpr->operands()) { Success &= pushSCEV(Op); if (EmitOperator >= 1) @@ -6490,7 +6490,7 @@ static void DbgGatherSalvagableDVI( Loop *L, ScalarEvolution &SE, SmallVector, 2> &SalvageableDVISCEVs, SmallSet, 2> &DVIHandles) { - for (auto &B : L->getBlocks()) { + for (const auto &B : L->getBlocks()) { for (auto &I : *B) { auto DVI = dyn_cast(&I); if (!DVI) @@ -6637,7 +6637,7 @@ static bool ReduceLoopStrength(Loop *L, IVUsers &IU, ScalarEvolution &SE, // Obtain relevant IVs and attempt to rewrite the salvageable DVIs with // expressions composed using the derived iteration count. // TODO: Allow for multiple IV references for nested AddRecSCEVs - for (auto &L : LI) { + for (const auto &L : LI) { if (llvm::PHINode *IV = GetInductionVariable(*L, SE, Reducer)) DbgRewriteSalvageableDVIs(L, SE, IV, SalvageableDVIRecords); else { diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index ca9ab3edcd0da..f993282b2e7d0 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -1583,7 +1583,7 @@ PreservedAnalyses LoopUnrollPass::run(Function &F, // legality and profitability checks. This means running the loop unroller // will simplify all loops, regardless of whether anything end up being // unrolled. - for (auto &L : LI) { + for (const auto &L : LI) { Changed |= simplifyLoop(L, &DT, &LI, &SE, &AC, nullptr, false /* PreserveLCSSA */); Changed |= formLCSSARecursively(*L, DT, &LI, &SE); diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index c4281b6060fe1..4c434155d162a 100644 --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -2176,7 +2176,7 @@ class LowerMatrixIntrinsics { // the inlinedAt chain. If the function does not have a DISubprogram, we // only map them to the containing function. MapVector> Subprog2Exprs; - for (auto &KV : Inst2Matrix) { + for (const auto &KV : Inst2Matrix) { if (Func.getSubprogram()) { auto *I = cast(KV.first); DILocation *Context = I->getDebugLoc(); diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index 955138bb511a8..7ea081f7e1ee5 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -207,7 +207,7 @@ struct TarjanSCC { Root[I] = ++DFSNum; // Store the DFS Number we had before it possibly gets incremented. unsigned int OurDFS = DFSNum; - for (auto &Op : I->operands()) { + for (const auto &Op : I->operands()) { if (auto *InstOp = dyn_cast(Op)) { if (Root.lookup(Op) == 0) FindSCC(InstOp); @@ -3218,7 +3218,7 @@ void NewGVN::verifyMemoryCongruency() const { // We could have phi nodes which operands are all trivially dead, // so we don't process them. if (auto *MemPHI = dyn_cast(Pair.first)) { - for (auto &U : MemPHI->incoming_values()) { + for (const auto &U : MemPHI->incoming_values()) { if (auto *I = dyn_cast(&*U)) { if (!isInstructionTriviallyDead(I)) return true; diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp index 01c0bf7786aca..8a4477d16d5ce 100644 --- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp @@ -1592,7 +1592,7 @@ deleteDeadClonedBlocks(Loop &L, ArrayRef ExitBlocks, // Find all the dead clones, and remove them from their successors. SmallVector DeadBlocks; for (BasicBlock *BB : llvm::concat(L.blocks(), ExitBlocks)) - for (auto &VMap : VMaps) + for (const auto &VMap : VMaps) if (BasicBlock *ClonedBB = cast_or_null(VMap->lookup(BB))) if (!DT.isReachableFromEntry(ClonedBB)) { for (BasicBlock *SuccBB : successors(ClonedBB)) @@ -2247,7 +2247,7 @@ static void unswitchNontrivialInvariants( assert(SI->getDefaultDest() == RetainedSuccBB && "Not retaining default successor!"); SI->setDefaultDest(LoopPH); - for (auto &Case : SI->cases()) + for (const auto &Case : SI->cases()) if (Case.getCaseSuccessor() == RetainedSuccBB) Case.setSuccessor(LoopPH); else @@ -2308,7 +2308,7 @@ static void unswitchNontrivialInvariants( SwitchInst *NewSI = cast(NewTI); assert(NewSI->getDefaultDest() == RetainedSuccBB && "Not retaining default successor!"); - for (auto &Case : NewSI->cases()) + for (const auto &Case : NewSI->cases()) Case.getCaseSuccessor()->removePredecessor( ParentBB, /*KeepOneInputPHIs*/ true); diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp index b58e18585dca6..faf1d69ac6ea1 100644 --- a/llvm/lib/Transforms/Utils/CodeLayout.cpp +++ b/llvm/lib/Transforms/Utils/CodeLayout.cpp @@ -666,7 +666,7 @@ class ExtTSPImpl { }); double Score = 0; - for (auto &Jump : Jumps) { + for (const auto &Jump : Jumps) { const auto SrcBlock = Jump->Source; const auto DstBlock = Jump->Target; Score += ::extTSPScore(SrcBlock->EstimatedAddr, SrcBlock->Size, @@ -711,7 +711,7 @@ class ExtTSPImpl { return; // Apply the merge, compute the corresponding gain, and update the best // value, if the merge is beneficial - for (auto &MergeType : MergeTypes) { + for (const auto &MergeType : MergeTypes) { Gain.updateIfLessThan( computeMergeGain(ChainPred, ChainSucc, Jumps, Offset, MergeType)); } diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp index a30f920d0036a..87be6be018857 100644 --- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp +++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp @@ -226,7 +226,7 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) { if (VI && ImportIndex.hasSyntheticEntryCounts()) { if (Function *F = dyn_cast(&GV)) { if (!F->isDeclaration()) { - for (auto &S : VI.getSummaryList()) { + for (const auto &S : VI.getSummaryList()) { auto *FS = cast(S->getBaseObject()); if (FS->modulePath() == M.getModuleIdentifier()) { F->setEntryCount(Function::ProfileCount(FS->entryCount(), diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp index 84d377d835f38..6de59f9eb5338 100644 --- a/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -417,7 +417,7 @@ bool llvm::formLCSSARecursively(Loop &L, const DominatorTree &DT, static bool formLCSSAOnAllLoops(const LoopInfo *LI, const DominatorTree &DT, ScalarEvolution *SE) { bool Changed = false; - for (auto &L : *LI) + for (const auto &L : *LI) Changed |= formLCSSARecursively(*L, DT, LI, SE); return Changed; } diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index c5f7a374c4ef6..25043b35b1bb2 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1587,7 +1587,7 @@ bool llvm::LowerDbgDeclare(Function &F) { WorkList.push_back(AI); while (!WorkList.empty()) { const Value *V = WorkList.pop_back_val(); - for (auto &AIUse : V->uses()) { + for (const auto &AIUse : V->uses()) { User *U = AIUse.getUser(); if (StoreInst *SI = dyn_cast(U)) { if (AIUse.getOperandNo() == 1) diff --git a/llvm/lib/Transforms/Utils/SampleProfileInference.cpp b/llvm/lib/Transforms/Utils/SampleProfileInference.cpp index d9005be2c8f3a..5b4177bda9f93 100644 --- a/llvm/lib/Transforms/Utils/SampleProfileInference.cpp +++ b/llvm/lib/Transforms/Utils/SampleProfileInference.cpp @@ -148,7 +148,7 @@ class MinCostMaxFlow { /// Returns a list of pairs (target node, amount of flow to the target). const std::vector> getFlow(uint64_t Src) const { std::vector> Flow; - for (auto &Edge : Edges[Src]) { + for (const auto &Edge : Edges[Src]) { if (Edge.Flow > 0) Flow.push_back(std::make_pair(Edge.Dst, Edge.Flow)); } @@ -158,7 +158,7 @@ class MinCostMaxFlow { /// Get the total flow between a pair of nodes. int64_t getFlow(uint64_t Src, uint64_t Dst) const { int64_t Flow = 0; - for (auto &Edge : Edges[Src]) { + for (const auto &Edge : Edges[Src]) { if (Edge.Dst == Dst) { Flow += Edge.Flow; } @@ -1137,7 +1137,7 @@ void extractWeights(MinCostMaxFlow &Network, FlowFunction &Func) { auto &Block = Func.Blocks[Src]; uint64_t SrcOut = 3 * Src + 1; int64_t Flow = 0; - for (auto &Adj : Network.getFlow(SrcOut)) { + for (const auto &Adj : Network.getFlow(SrcOut)) { uint64_t DstIn = Adj.first; int64_t DstFlow = Adj.second; bool IsAuxNode = (DstIn < 3 * NumBlocks && DstIn % 3 == 2); @@ -1176,7 +1176,7 @@ void verifyWeights(const FlowFunction &Func) { const uint64_t NumBlocks = Func.Blocks.size(); auto InFlow = std::vector(NumBlocks, 0); auto OutFlow = std::vector(NumBlocks, 0); - for (auto &Jump : Func.Jumps) { + for (const auto &Jump : Func.Jumps) { InFlow[Jump.Target] += Jump.Flow; OutFlow[Jump.Source] += Jump.Flow; } @@ -1202,7 +1202,7 @@ void verifyWeights(const FlowFunction &Func) { // One could modify FlowFunction to hold edges indexed by the sources, which // will avoid a creation of the object auto PositiveFlowEdges = std::vector>(NumBlocks); - for (auto &Jump : Func.Jumps) { + for (const auto &Jump : Func.Jumps) { if (Jump.Flow > 0) { PositiveFlowEdges[Jump.Source].push_back(Jump.Target); } diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 164a9164ee11b..197b0d75d0912 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -5272,7 +5272,7 @@ static bool eliminateDeadSwitchCases(SwitchInst *SI, DomTreeUpdater *DTU, SmallVector DeadCases; SmallDenseMap NumPerSuccessorCases; SmallVector UniqueSuccessors; - for (auto &Case : SI->cases()) { + for (const auto &Case : SI->cases()) { auto *Successor = Case.getCaseSuccessor(); if (DTU) { if (!NumPerSuccessorCases.count(Successor)) @@ -5372,7 +5372,7 @@ static bool ForwardSwitchConditionToPHI(SwitchInst *SI) { ForwardingNodesMap ForwardingNodes; BasicBlock *SwitchBlock = SI->getParent(); bool Changed = false; - for (auto &Case : SI->cases()) { + for (const auto &Case : SI->cases()) { ConstantInt *CaseValue = Case.getCaseValue(); BasicBlock *CaseDest = Case.getCaseSuccessor(); @@ -5588,7 +5588,7 @@ static bool initializeUniqueCases(SwitchInst *SI, PHINode *&PHI, const DataLayout &DL, const TargetTransformInfo &TTI, uintptr_t MaxUniqueResults) { - for (auto &I : SI->cases()) { + for (const auto &I : SI->cases()) { ConstantInt *CaseVal = I.getCaseValue(); // Resulting value at phi nodes for this case value. @@ -6494,7 +6494,7 @@ static bool ReduceSwitchRange(SwitchInst *SI, IRBuilder<> &Builder, // cases such as a sequence crossing zero {-4,0,4,8} if we interpret case values // as signed. SmallVector Values; - for (auto &C : SI->cases()) + for (const auto &C : SI->cases()) Values.push_back(C.getCaseValue()->getValue().getSExtValue()); llvm::sort(Values); @@ -7043,7 +7043,7 @@ static bool removeUndefIntroducingPredecessor(BasicBlock *BB, Builder.SetInsertPoint(Unreachable); // The new block contains only one instruction: Unreachable Builder.CreateUnreachable(); - for (auto &Case : SI->cases()) + for (const auto &Case : SI->cases()) if (Case.getCaseSuccessor() == BB) { BB->removePredecessor(Predecessor); Case.setSuccessor(Unreachable); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp index 183ba86abcb40..dff43efe494af 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp @@ -1364,7 +1364,7 @@ bool LoopVectorizationLegality::prepareToFoldTailByMasking() { SmallPtrSet ReductionLiveOuts; - for (auto &Reduction : getReductionVars()) + for (const auto &Reduction : getReductionVars()) ReductionLiveOuts.insert(Reduction.second.getLoopExitInstr()); // TODO: handle non-reduction outside users when tail is folded by masking. diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 91a452ef197c4..fd6b274811ffe 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2755,7 +2755,7 @@ void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr, // Replace the operands of the cloned instructions with their scalar // equivalents in the new loop. - for (auto &I : enumerate(RepRecipe->operands())) { + for (const auto &I : enumerate(RepRecipe->operands())) { auto InputInstance = Instance; VPValue *Operand = I.value(); VPReplicateRecipe *OperandR = dyn_cast(Operand); @@ -3100,7 +3100,7 @@ void InnerLoopVectorizer::createInductionResumeValues( // If we come from a bypass edge then we need to start from the original // start value. Instruction *OldInduction = Legal->getPrimaryInduction(); - for (auto &InductionEntry : Legal->getInductionVars()) { + for (const auto &InductionEntry : Legal->getInductionVars()) { PHINode *OrigPhi = InductionEntry.first; InductionDescriptor II = InductionEntry.second; @@ -3655,7 +3655,7 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State, // edge. // Fix-up external users of the induction variables. - for (auto &Entry : Legal->getInductionVars()) + for (const auto &Entry : Legal->getInductionVars()) fixupIVUsers(Entry.first, Entry.second, getOrCreateVectorTripCount(VectorLoop->getLoopPreheader()), IVEndValues[Entry.first], LoopMiddleBlock, @@ -3665,7 +3665,7 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State, // Fix LCSSA phis not already fixed earlier. Extracts may need to be generated // in the exit block, so update the builder. State.Builder.SetInsertPoint(State.CFG.ExitBB->getFirstNonPHI()); - for (auto &KV : Plan.getLiveOuts()) + for (const auto &KV : Plan.getLiveOuts()) KV.second->fixPhi(Plan, State); for (Instruction *PI : PredicatedInstructions) @@ -4182,7 +4182,7 @@ void InnerLoopVectorizer::widenCallInstruction(CallInst &CI, VPValue *Def, for (unsigned Part = 0; Part < UF; ++Part) { SmallVector TysForDecl = {CI.getType()}; SmallVector Args; - for (auto &I : enumerate(ArgOperands.operands())) { + for (const auto &I : enumerate(ArgOperands.operands())) { // Some intrinsics have a scalar argument - don't replace it with a // vector. Value *Arg; @@ -4359,7 +4359,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) { // An induction variable will remain scalar if all users of the induction // variable and induction variable update remain scalar. - for (auto &Induction : Legal->getInductionVars()) { + for (const auto &Induction : Legal->getInductionVars()) { auto *Ind = Induction.first; auto *IndUpdate = cast(Ind->getIncomingValueForBlock(Latch)); @@ -4749,7 +4749,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) { // nodes separately. An induction variable will remain uniform if all users // of the induction variable and induction variable update remain uniform. // The code below handles both pointer and non-pointer induction variables. - for (auto &Induction : Legal->getInductionVars()) { + for (const auto &Induction : Legal->getInductionVars()) { auto *Ind = Induction.first; auto *IndUpdate = cast(Ind->getIncomingValueForBlock(Latch)); @@ -5381,7 +5381,7 @@ VectorizationFactor LoopVectorizationCostModel::selectVectorizationFactor( raw_string_ostream OS(OutString); assert(!Subset.empty() && "Unexpected empty range"); OS << "Instruction with invalid costs prevented vectorization at VF=("; - for (auto &Pair : Subset) + for (const auto &Pair : Subset) OS << (Pair.second == Subset.front().second ? "" : ", ") << Pair.second; OS << "):"; @@ -5424,7 +5424,7 @@ bool LoopVectorizationCostModel::isCandidateForEpilogueVectorization( // Phis with uses outside of the loop require special handling and are // currently unsupported. - for (auto &Entry : Legal->getInductionVars()) { + for (const auto &Entry : Legal->getInductionVars()) { // Look for uses of the value of the induction at the last iteration. Value *PostInc = Entry.first->getIncomingValueForBlock(L.getLoopLatch()); for (User *U : PostInc->users()) @@ -5558,7 +5558,7 @@ LoopVectorizationCostModel::getSmallestAndWidestTypes() { // Reset MaxWidth so that we can find the smallest type used by recurrences // in the loop. MaxWidth = -1U; - for (auto &PhiDescriptorPair : Legal->getReductionVars()) { + for (const auto &PhiDescriptorPair : Legal->getReductionVars()) { const RecurrenceDescriptor &RdxDesc = PhiDescriptorPair.second; // When finding the min width used by the recurrence we need to account // for casts on the input operands of the recurrence. @@ -7342,14 +7342,14 @@ void LoopVectorizationCostModel::collectValuesToIgnore() { // Ignore type-promoting instructions we identified during reduction // detection. - for (auto &Reduction : Legal->getReductionVars()) { + for (const auto &Reduction : Legal->getReductionVars()) { const RecurrenceDescriptor &RedDes = Reduction.second; const SmallPtrSetImpl &Casts = RedDes.getCastInsts(); VecValuesToIgnore.insert(Casts.begin(), Casts.end()); } // Ignore type-casting instructions we identified during induction // detection. - for (auto &Induction : Legal->getInductionVars()) { + for (const auto &Induction : Legal->getInductionVars()) { const InductionDescriptor &IndDes = Induction.second; const SmallVectorImpl &Casts = IndDes.getCastInsts(); VecValuesToIgnore.insert(Casts.begin(), Casts.end()); @@ -7357,7 +7357,7 @@ void LoopVectorizationCostModel::collectValuesToIgnore() { } void LoopVectorizationCostModel::collectInLoopReductions() { - for (auto &Reduction : Legal->getReductionVars()) { + for (const auto &Reduction : Legal->getReductionVars()) { PHINode *Phi = Reduction.first; const RecurrenceDescriptor &RdxDesc = Reduction.second; @@ -8721,18 +8721,18 @@ VPlanPtr LoopVectorizationPlanner::buildVPlanWithVPRecipes( // Mark instructions we'll need to sink later and their targets as // ingredients whose recipe we'll need to record. - for (auto &Entry : SinkAfter) { + for (const auto &Entry : SinkAfter) { RecipeBuilder.recordRecipeOf(Entry.first); RecipeBuilder.recordRecipeOf(Entry.second); } - for (auto &Reduction : CM.getInLoopReductionChains()) { + for (const auto &Reduction : CM.getInLoopReductionChains()) { PHINode *Phi = Reduction.first; RecurKind Kind = Legal->getReductionVars().find(Phi)->second.getRecurrenceKind(); const SmallVector &ReductionOperations = Reduction.second; RecipeBuilder.recordRecipeOf(Phi); - for (auto &R : ReductionOperations) { + for (const auto &R : ReductionOperations) { RecipeBuilder.recordRecipeOf(R); // For min/max reductions, where we have a pair of icmp/select, we also // need to record the ICmp recipe, so it can be removed later. @@ -8913,7 +8913,7 @@ VPlanPtr LoopVectorizationPlanner::buildVPlanWithVPRecipes( } return nullptr; }; - for (auto &Entry : SinkAfter) { + for (const auto &Entry : SinkAfter) { VPRecipeBase *Sink = RecipeBuilder.getRecipe(Entry.first); VPRecipeBase *Target = RecipeBuilder.getRecipe(Entry.second); @@ -9112,7 +9112,7 @@ VPlanPtr LoopVectorizationPlanner::buildVPlan(VFRange &Range) { void LoopVectorizationPlanner::adjustRecipesForReductions( VPBasicBlock *LatchVPBB, VPlanPtr &Plan, VPRecipeBuilder &RecipeBuilder, ElementCount MinVF) { - for (auto &Reduction : CM.getInLoopReductionChains()) { + for (const auto &Reduction : CM.getInLoopReductionChains()) { PHINode *Phi = Reduction.first; const RecurrenceDescriptor &RdxDesc = Legal->getReductionVars().find(Phi)->second; @@ -10496,7 +10496,7 @@ LoopVectorizeResult LoopVectorizePass::runImpl( // legality and profitability checks. This means running the loop vectorizer // will simplify all loops, regardless of whether anything end up being // vectorized. - for (auto &L : *LI) + for (const auto &L : *LI) Changed |= CFGChanged |= simplifyLoop(L, DT, LI, SE, AC, nullptr, false /* PreserveLCSSA */); diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index 30032dda7f60a..f78ccff7f9cd3 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -768,7 +768,7 @@ void VPlan::print(raw_ostream &O) const { if (!LiveOuts.empty()) O << "\n"; - for (auto &KV : LiveOuts) { + for (const auto &KV : LiveOuts) { O << "Live-out "; KV.second->getPhi()->printAsOperand(O); O << " = "; diff --git a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp index 43e0a40fedb93..91ab693203103 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp @@ -282,7 +282,7 @@ bool VPlanVerifier::verifyPlanIsValid(const VPlan &Plan) { } } - for (auto &KV : Plan.getLiveOuts()) + for (const auto &KV : Plan.getLiveOuts()) if (KV.second->getNumOperands() != 1) { errs() << "live outs must have a single operand\n"; return false;