[PATCH] D138616: [NFC] Use BB->size() instead of BB->getInstList().size().

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 17:26:49 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8b9a62ee492b: [NFC] Use BB->size() instead of BB->getInstList().size(). (authored by vporpo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138616/new/

https://reviews.llvm.org/D138616

Files:
  llvm/lib/Analysis/DomTreeUpdater.cpp
  llvm/lib/Analysis/LoopNestAnalysis.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp


Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
===================================================================
--- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -85,7 +85,7 @@
       BB->getInstList().pop_back();
     }
     new UnreachableInst(BB->getContext(), BB);
-    assert(BB->getInstList().size() == 1 &&
+    assert(BB->size() == 1 &&
            isa<UnreachableInst>(BB->getTerminator()) &&
            "The successor list of BB isn't empty before "
            "applying corresponding DTU updates.");
Index: llvm/lib/Analysis/LoopNestAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/LoopNestAnalysis.cpp
+++ llvm/lib/Analysis/LoopNestAnalysis.cpp
@@ -295,7 +295,7 @@
     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 @@
 
         // 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 =
Index: llvm/lib/Analysis/DomTreeUpdater.cpp
===================================================================
--- llvm/lib/Analysis/DomTreeUpdater.cpp
+++ llvm/lib/Analysis/DomTreeUpdater.cpp
@@ -106,8 +106,7 @@
     // 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<UnreachableInst>(BB->getTerminator()) &&
+    assert(BB->size() == 1 && isa<UnreachableInst>(BB->getTerminator()) &&
            "DelBB has been modified while awaiting deletion.");
     BB->removeFromParent();
     eraseDelBBNode(BB);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138616.477662.patch
Type: text/x-patch
Size: 2065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221124/64c9b096/attachment.bin>


More information about the llvm-commits mailing list