[VPlan] Remove unnecessary getNumSuccessors call (NFC).
authorFlorian Hahn <flo@fhahn.com>
Tue, 17 Jan 2023 11:44:49 +0000 (11:44 +0000)
committerFlorian Hahn <flo@fhahn.com>
Tue, 17 Jan 2023 11:44:50 +0000 (11:44 +0000)
If ParentWithSuccs is nullptr, the number of successors is guaranteed to
be 0. Simplify the code as suggested by @Ayal in D140511.

llvm/lib/Transforms/Vectorize/VPlanCFG.h

index c563b43..cd8db21 100644 (file)
@@ -189,9 +189,8 @@ public:
 
   static VPAllSuccessorsIterator end(BlockPtrTy Block) {
     BlockPtrTy ParentWithSuccs = getBlockWithSuccs(Block);
-    unsigned NumSuccessors = ParentWithSuccs
-                                 ? ParentWithSuccs->getNumSuccessors()
-                                 : Block->getNumSuccessors();
+    unsigned NumSuccessors =
+        ParentWithSuccs ? ParentWithSuccs->getNumSuccessors() : 0;
 
     if (auto *R = dyn_cast<VPRegionBlock>(Block))
       return {R, NumSuccessors + 1};