From 8b9a62ee492be1b5348ffc8bc7b3df8b184d19b9 Mon Sep 17 00:00:00 2001 From: Vasileios Porpodas Date: Wed, 23 Nov 2022 14:30:18 -0800 Subject: [PATCH] [NFC] Use BB->size() instead of BB->getInstList().size(). Differential Revision: https://reviews.llvm.org/D138616 --- llvm/lib/Analysis/DomTreeUpdater.cpp | 3 +-- llvm/lib/Analysis/LoopNestAnalysis.cpp | 4 ++-- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Analysis/DomTreeUpdater.cpp b/llvm/lib/Analysis/DomTreeUpdater.cpp index f878774..d21948f 100644 --- a/llvm/lib/Analysis/DomTreeUpdater.cpp +++ b/llvm/lib/Analysis/DomTreeUpdater.cpp @@ -106,8 +106,7 @@ bool DomTreeUpdater::forceFlushDeletedBB() { // validateDeleteBB() removes all instructions of DelBB and adds an // UnreachableInst as its terminator. So we check whether the BasicBlock to // delete only has an UnreachableInst inside. - assert(BB->getInstList().size() == 1 && - isa(BB->getTerminator()) && + assert(BB->size() == 1 && isa(BB->getTerminator()) && "DelBB has been modified while awaiting deletion."); BB->removeFromParent(); eraseDelBBNode(BB); diff --git a/llvm/lib/Analysis/LoopNestAnalysis.cpp b/llvm/lib/Analysis/LoopNestAnalysis.cpp index bff796f..9c75193 100644 --- a/llvm/lib/Analysis/LoopNestAnalysis.cpp +++ b/llvm/lib/Analysis/LoopNestAnalysis.cpp @@ -295,7 +295,7 @@ const BasicBlock &LoopNest::skipEmptyBlockUntil(const BasicBlock *From, return *From; auto IsEmpty = [](const BasicBlock *BB) { - return (BB->getInstList().size() == 1); + return (BB->size() == 1); }; // Visited is used to avoid running into an infinite loop. @@ -379,7 +379,7 @@ static bool checkLoopsStructure(const Loop &OuterLoop, const Loop &InnerLoop, // Ensure the inner loop guard successor is empty before skipping // blocks. - if (Succ->getInstList().size() == 1) { + if (Succ->size() == 1) { PotentialInnerPreHeader = &LoopNest::skipEmptyBlockUntil(Succ, InnerLoopPreHeader); PotentialOuterLatch = diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 2a16203..cf783ca 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -85,7 +85,7 @@ void llvm::detachDeadBlocks( BB->getInstList().pop_back(); } new UnreachableInst(BB->getContext(), BB); - assert(BB->getInstList().size() == 1 && + assert(BB->size() == 1 && isa(BB->getTerminator()) && "The successor list of BB isn't empty before " "applying corresponding DTU updates."); -- 2.7.4