diff --git a/llvm/lib/Analysis/CFLGraph.h b/llvm/lib/Analysis/CFLGraph.h index 47bb02ac8e8b33..1e14f65a40d816 100644 --- a/llvm/lib/Analysis/CFLGraph.h +++ b/llvm/lib/Analysis/CFLGraph.h @@ -643,7 +643,7 @@ template class CFLGraphBuilder { GetEdgesVisitor Visitor(*this, Fn.getParent()->getDataLayout()); for (auto &Bb : Fn.getBasicBlockList()) - for (auto &Inst : Bb.getInstList()) + for (auto &Inst : Bb) addInstructionToGraph(Visitor, Inst); for (auto &Arg : Fn.args()) diff --git a/llvm/lib/Transforms/CFGuard/CFGuard.cpp b/llvm/lib/Transforms/CFGuard/CFGuard.cpp index b1367cafdafda3..55ef7c214fc844 100644 --- a/llvm/lib/Transforms/CFGuard/CFGuard.cpp +++ b/llvm/lib/Transforms/CFGuard/CFGuard.cpp @@ -273,7 +273,7 @@ bool CFGuard::runOnFunction(Function &F) { // call/invoke/callbr instructions because the original instructions will be // deleted as the checks are added. for (BasicBlock &BB : F.getBasicBlockList()) { - for (Instruction &I : BB.getInstList()) { + for (Instruction &I : BB) { auto *CB = dyn_cast(&I); if (CB && CB->isIndirectCall() && !CB->hasFnAttr("guard_nocf")) { IndirectCalls.push_back(CB); diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 66c1e5b4bd594d..deca83d4d62de8 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -1154,7 +1154,7 @@ bool SampleProfileLoader::inlineHotFunctions( bool Hot = false; SmallVector AllCandidates; SmallVector ColdCandidates; - for (auto &I : BB.getInstList()) { + for (auto &I : BB) { const FunctionSamples *FS = nullptr; if (auto *CB = dyn_cast(&I)) { if (!isa(I)) { @@ -1423,7 +1423,7 @@ bool SampleProfileLoader::inlineHotFunctionsWithPriority( CandidateQueue CQueue; InlineCandidate NewCandidate; for (auto &BB : F) { - for (auto &I : BB.getInstList()) { + for (auto &I : BB) { auto *CB = dyn_cast(&I); if (!CB) continue; @@ -1617,7 +1617,7 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) { BasicBlock *BB = &BI; if (BlockWeights[BB]) { - for (auto &I : BB->getInstList()) { + for (auto &I : *BB) { if (!isa(I) && !isa(I)) continue; if (!cast(I).getCalledFunction()) { @@ -1669,7 +1669,7 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) { } else if (OverwriteExistingWeights || ProfileSampleBlockAccurate) { // Set profile metadata (possibly annotated by LTO prelink) to zero or // clear it for cold code. - for (auto &I : BB->getInstList()) { + for (auto &I : *BB) { if (isa(I) || isa(I)) { if (cast(I).isIndirectCall()) I.setMetadata(LLVMContext::MD_prof, nullptr); @@ -2072,7 +2072,7 @@ void SampleProfileMatcher::detectProfileMismatch(const Function &F, // Go through all the callsites on the IR and flag the callsite if the target // name is the same as the one in the profile. for (auto &BB : F) { - for (auto &I : BB.getInstList()) { + for (auto &I : BB) { if (!isa(&I) || isa(&I)) continue; diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 429a98b4a6d2f1..a34bc95cbed5d4 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -1258,7 +1258,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { // See if any instructions in the block can be eliminated. If so, do it. If // not, add them to AvailableValues. - for (Instruction &Inst : make_early_inc_range(BB->getInstList())) { + for (Instruction &Inst : make_early_inc_range(*BB)) { // Dead instructions should just be removed. if (isInstructionTriviallyDead(&Inst, &TLI)) { LLVM_DEBUG(dbgs() << "EarlyCSE DCE: " << Inst << '\n'); diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index e6372fc5ab86bf..56acdcc0bc3c8e 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -193,7 +193,7 @@ static bool addDiscriminators(Function &F) { // of the instruction appears in other basic block, assign a new // discriminator for this instruction. for (BasicBlock &B : F) { - for (auto &I : B.getInstList()) { + for (auto &I : B) { // Not all intrinsic calls should have a discriminator. // We want to avoid a non-deterministic assignment of discriminators at // different debug levels. We still allow discriminators on memory @@ -237,7 +237,7 @@ static bool addDiscriminators(Function &F) { // a same source line for correct profile annotation. for (BasicBlock &B : F) { LocationSet CallLocations; - for (auto &I : B.getInstList()) { + for (auto &I : B) { // We bypass intrinsic calls for the following two reasons: // 1) We want to avoid a non-deterministic assignment of // discriminators.