Skip to content

Commit 8a1ccb8

Browse files
committed
[NFC] Removed call to getInstList() from range loops on BBs.
Differential Revision: https://reviews.llvm.org/D138605
1 parent 21d434d commit 8a1ccb8

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

llvm/lib/Analysis/CFLGraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ template <typename CFLAA> class CFLGraphBuilder {
643643
GetEdgesVisitor Visitor(*this, Fn.getParent()->getDataLayout());
644644

645645
for (auto &Bb : Fn.getBasicBlockList())
646-
for (auto &Inst : Bb.getInstList())
646+
for (auto &Inst : Bb)
647647
addInstructionToGraph(Visitor, Inst);
648648

649649
for (auto &Arg : Fn.args())

llvm/lib/Transforms/CFGuard/CFGuard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ bool CFGuard::runOnFunction(Function &F) {
273273
// call/invoke/callbr instructions because the original instructions will be
274274
// deleted as the checks are added.
275275
for (BasicBlock &BB : F.getBasicBlockList()) {
276-
for (Instruction &I : BB.getInstList()) {
276+
for (Instruction &I : BB) {
277277
auto *CB = dyn_cast<CallBase>(&I);
278278
if (CB && CB->isIndirectCall() && !CB->hasFnAttr("guard_nocf")) {
279279
IndirectCalls.push_back(CB);

llvm/lib/Transforms/IPO/SampleProfile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ bool SampleProfileLoader::inlineHotFunctions(
11541154
bool Hot = false;
11551155
SmallVector<CallBase *, 10> AllCandidates;
11561156
SmallVector<CallBase *, 10> ColdCandidates;
1157-
for (auto &I : BB.getInstList()) {
1157+
for (auto &I : BB) {
11581158
const FunctionSamples *FS = nullptr;
11591159
if (auto *CB = dyn_cast<CallBase>(&I)) {
11601160
if (!isa<IntrinsicInst>(I)) {
@@ -1423,7 +1423,7 @@ bool SampleProfileLoader::inlineHotFunctionsWithPriority(
14231423
CandidateQueue CQueue;
14241424
InlineCandidate NewCandidate;
14251425
for (auto &BB : F) {
1426-
for (auto &I : BB.getInstList()) {
1426+
for (auto &I : BB) {
14271427
auto *CB = dyn_cast<CallBase>(&I);
14281428
if (!CB)
14291429
continue;
@@ -1617,7 +1617,7 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) {
16171617
BasicBlock *BB = &BI;
16181618

16191619
if (BlockWeights[BB]) {
1620-
for (auto &I : BB->getInstList()) {
1620+
for (auto &I : *BB) {
16211621
if (!isa<CallInst>(I) && !isa<InvokeInst>(I))
16221622
continue;
16231623
if (!cast<CallBase>(I).getCalledFunction()) {
@@ -1669,7 +1669,7 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) {
16691669
} else if (OverwriteExistingWeights || ProfileSampleBlockAccurate) {
16701670
// Set profile metadata (possibly annotated by LTO prelink) to zero or
16711671
// clear it for cold code.
1672-
for (auto &I : BB->getInstList()) {
1672+
for (auto &I : *BB) {
16731673
if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
16741674
if (cast<CallBase>(I).isIndirectCall())
16751675
I.setMetadata(LLVMContext::MD_prof, nullptr);
@@ -2072,7 +2072,7 @@ void SampleProfileMatcher::detectProfileMismatch(const Function &F,
20722072
// Go through all the callsites on the IR and flag the callsite if the target
20732073
// name is the same as the one in the profile.
20742074
for (auto &BB : F) {
2075-
for (auto &I : BB.getInstList()) {
2075+
for (auto &I : BB) {
20762076
if (!isa<CallBase>(&I) || isa<IntrinsicInst>(&I))
20772077
continue;
20782078

llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
12581258

12591259
// See if any instructions in the block can be eliminated. If so, do it. If
12601260
// not, add them to AvailableValues.
1261-
for (Instruction &Inst : make_early_inc_range(BB->getInstList())) {
1261+
for (Instruction &Inst : make_early_inc_range(*BB)) {
12621262
// Dead instructions should just be removed.
12631263
if (isInstructionTriviallyDead(&Inst, &TLI)) {
12641264
LLVM_DEBUG(dbgs() << "EarlyCSE DCE: " << Inst << '\n');

llvm/lib/Transforms/Utils/AddDiscriminators.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static bool addDiscriminators(Function &F) {
193193
// of the instruction appears in other basic block, assign a new
194194
// discriminator for this instruction.
195195
for (BasicBlock &B : F) {
196-
for (auto &I : B.getInstList()) {
196+
for (auto &I : B) {
197197
// Not all intrinsic calls should have a discriminator.
198198
// We want to avoid a non-deterministic assignment of discriminators at
199199
// different debug levels. We still allow discriminators on memory
@@ -237,7 +237,7 @@ static bool addDiscriminators(Function &F) {
237237
// a same source line for correct profile annotation.
238238
for (BasicBlock &B : F) {
239239
LocationSet CallLocations;
240-
for (auto &I : B.getInstList()) {
240+
for (auto &I : B) {
241241
// We bypass intrinsic calls for the following two reasons:
242242
// 1) We want to avoid a non-deterministic assignment of
243243
// discriminators.

0 commit comments

Comments
 (0)