[NFC] Removed call to getInstList() from range loops on BBs.
Differential Revision: https://reviews.llvm.org/D138605
This commit is contained in:
parent
21d434d997
commit
8a1ccb8ae0
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue