[NFC] Removed call to getInstList() from range loops on BBs.

Differential Revision: https://reviews.llvm.org/D138605
This commit is contained in:
Vasileios Porpodas 2022-11-23 13:30:03 -08:00
parent 21d434d997
commit 8a1ccb8ae0
5 changed files with 10 additions and 10 deletions

View File

@ -643,7 +643,7 @@ template <typename CFLAA> class CFLGraphBuilder {
GetEdgesVisitor Visitor(*this, Fn.getParent()->getDataLayout()); GetEdgesVisitor Visitor(*this, Fn.getParent()->getDataLayout());
for (auto &Bb : Fn.getBasicBlockList()) for (auto &Bb : Fn.getBasicBlockList())
for (auto &Inst : Bb.getInstList()) for (auto &Inst : Bb)
addInstructionToGraph(Visitor, Inst); addInstructionToGraph(Visitor, Inst);
for (auto &Arg : Fn.args()) for (auto &Arg : Fn.args())

View File

@ -273,7 +273,7 @@ bool CFGuard::runOnFunction(Function &F) {
// call/invoke/callbr instructions because the original instructions will be // call/invoke/callbr instructions because the original instructions will be
// deleted as the checks are added. // deleted as the checks are added.
for (BasicBlock &BB : F.getBasicBlockList()) { for (BasicBlock &BB : F.getBasicBlockList()) {
for (Instruction &I : BB.getInstList()) { for (Instruction &I : BB) {
auto *CB = dyn_cast<CallBase>(&I); auto *CB = dyn_cast<CallBase>(&I);
if (CB && CB->isIndirectCall() && !CB->hasFnAttr("guard_nocf")) { if (CB && CB->isIndirectCall() && !CB->hasFnAttr("guard_nocf")) {
IndirectCalls.push_back(CB); IndirectCalls.push_back(CB);

View File

@ -1154,7 +1154,7 @@ bool SampleProfileLoader::inlineHotFunctions(
bool Hot = false; bool Hot = false;
SmallVector<CallBase *, 10> AllCandidates; SmallVector<CallBase *, 10> AllCandidates;
SmallVector<CallBase *, 10> ColdCandidates; SmallVector<CallBase *, 10> ColdCandidates;
for (auto &I : BB.getInstList()) { for (auto &I : BB) {
const FunctionSamples *FS = nullptr; const FunctionSamples *FS = nullptr;
if (auto *CB = dyn_cast<CallBase>(&I)) { if (auto *CB = dyn_cast<CallBase>(&I)) {
if (!isa<IntrinsicInst>(I)) { if (!isa<IntrinsicInst>(I)) {
@ -1423,7 +1423,7 @@ bool SampleProfileLoader::inlineHotFunctionsWithPriority(
CandidateQueue CQueue; CandidateQueue CQueue;
InlineCandidate NewCandidate; InlineCandidate NewCandidate;
for (auto &BB : F) { for (auto &BB : F) {
for (auto &I : BB.getInstList()) { for (auto &I : BB) {
auto *CB = dyn_cast<CallBase>(&I); auto *CB = dyn_cast<CallBase>(&I);
if (!CB) if (!CB)
continue; continue;
@ -1617,7 +1617,7 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) {
BasicBlock *BB = &BI; BasicBlock *BB = &BI;
if (BlockWeights[BB]) { if (BlockWeights[BB]) {
for (auto &I : BB->getInstList()) { for (auto &I : *BB) {
if (!isa<CallInst>(I) && !isa<InvokeInst>(I)) if (!isa<CallInst>(I) && !isa<InvokeInst>(I))
continue; continue;
if (!cast<CallBase>(I).getCalledFunction()) { if (!cast<CallBase>(I).getCalledFunction()) {
@ -1669,7 +1669,7 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) {
} else if (OverwriteExistingWeights || ProfileSampleBlockAccurate) { } else if (OverwriteExistingWeights || ProfileSampleBlockAccurate) {
// Set profile metadata (possibly annotated by LTO prelink) to zero or // Set profile metadata (possibly annotated by LTO prelink) to zero or
// clear it for cold code. // clear it for cold code.
for (auto &I : BB->getInstList()) { for (auto &I : *BB) {
if (isa<CallInst>(I) || isa<InvokeInst>(I)) { if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
if (cast<CallBase>(I).isIndirectCall()) if (cast<CallBase>(I).isIndirectCall())
I.setMetadata(LLVMContext::MD_prof, nullptr); 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 // 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. // name is the same as the one in the profile.
for (auto &BB : F) { for (auto &BB : F) {
for (auto &I : BB.getInstList()) { for (auto &I : BB) {
if (!isa<CallBase>(&I) || isa<IntrinsicInst>(&I)) if (!isa<CallBase>(&I) || isa<IntrinsicInst>(&I))
continue; continue;

View File

@ -1258,7 +1258,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
// See if any instructions in the block can be eliminated. If so, do it. If // See if any instructions in the block can be eliminated. If so, do it. If
// not, add them to AvailableValues. // 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. // Dead instructions should just be removed.
if (isInstructionTriviallyDead(&Inst, &TLI)) { if (isInstructionTriviallyDead(&Inst, &TLI)) {
LLVM_DEBUG(dbgs() << "EarlyCSE DCE: " << Inst << '\n'); LLVM_DEBUG(dbgs() << "EarlyCSE DCE: " << Inst << '\n');

View File

@ -193,7 +193,7 @@ static bool addDiscriminators(Function &F) {
// of the instruction appears in other basic block, assign a new // of the instruction appears in other basic block, assign a new
// discriminator for this instruction. // discriminator for this instruction.
for (BasicBlock &B : F) { for (BasicBlock &B : F) {
for (auto &I : B.getInstList()) { for (auto &I : B) {
// Not all intrinsic calls should have a discriminator. // Not all intrinsic calls should have a discriminator.
// We want to avoid a non-deterministic assignment of discriminators at // We want to avoid a non-deterministic assignment of discriminators at
// different debug levels. We still allow discriminators on memory // 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. // a same source line for correct profile annotation.
for (BasicBlock &B : F) { for (BasicBlock &B : F) {
LocationSet CallLocations; LocationSet CallLocations;
for (auto &I : B.getInstList()) { for (auto &I : B) {
// We bypass intrinsic calls for the following two reasons: // We bypass intrinsic calls for the following two reasons:
// 1) We want to avoid a non-deterministic assignment of // 1) We want to avoid a non-deterministic assignment of
// discriminators. // discriminators.