[llvm] 8a1ccb8 - [NFC] Removed call to getInstList() from range loops on BBs.
Vasileios Porpodas via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 17:55:46 PST 2022
Author: Vasileios Porpodas
Date: 2022-11-29T17:33:10-08:00
New Revision: 8a1ccb8ae006fdb2f84a16f0f85f08a79ed98774
URL: https://github.com/llvm/llvm-project/commit/8a1ccb8ae006fdb2f84a16f0f85f08a79ed98774
DIFF: https://github.com/llvm/llvm-project/commit/8a1ccb8ae006fdb2f84a16f0f85f08a79ed98774.diff
LOG: [NFC] Removed call to getInstList() from range loops on BBs.
Differential Revision: https://reviews.llvm.org/D138605
Added:
Modified:
llvm/lib/Analysis/CFLGraph.h
llvm/lib/Transforms/CFGuard/CFGuard.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/lib/Transforms/Utils/AddDiscriminators.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/CFLGraph.h b/llvm/lib/Analysis/CFLGraph.h
index 47bb02ac8e8b3..1e14f65a40d81 100644
--- a/llvm/lib/Analysis/CFLGraph.h
+++ b/llvm/lib/Analysis/CFLGraph.h
@@ -643,7 +643,7 @@ template <typename CFLAA> 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 b1367cafdafda..55ef7c214fc84 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<CallBase>(&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 66c1e5b4bd594..deca83d4d62de 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<CallBase *, 10> AllCandidates;
SmallVector<CallBase *, 10> ColdCandidates;
- for (auto &I : BB.getInstList()) {
+ for (auto &I : BB) {
const FunctionSamples *FS = nullptr;
if (auto *CB = dyn_cast<CallBase>(&I)) {
if (!isa<IntrinsicInst>(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<CallBase>(&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<CallInst>(I) && !isa<InvokeInst>(I))
continue;
if (!cast<CallBase>(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<CallInst>(I) || isa<InvokeInst>(I)) {
if (cast<CallBase>(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<CallBase>(&I) || isa<IntrinsicInst>(&I))
continue;
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
index 429a98b4a6d2f..a34bc95cbed5d 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 e6372fc5ab86b..56acdcc0bc3c8 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
//
diff erent 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.
More information about the llvm-commits
mailing list