[llvm] c951383 - [VPlan] Remove unnecessary getNumSuccessors call (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 03:45:42 PST 2023


Author: Florian Hahn
Date: 2023-01-17T11:44:50Z
New Revision: c95138392a75021c98f53b423b29995cb8a3283b

URL: https://github.com/llvm/llvm-project/commit/c95138392a75021c98f53b423b29995cb8a3283b
DIFF: https://github.com/llvm/llvm-project/commit/c95138392a75021c98f53b423b29995cb8a3283b.diff

LOG: [VPlan] Remove unnecessary getNumSuccessors call (NFC).

If ParentWithSuccs is nullptr, the number of successors is guaranteed to
be 0. Simplify the code as suggested by @Ayal in D140511.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanCFG.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanCFG.h b/llvm/lib/Transforms/Vectorize/VPlanCFG.h
index c563b438de4c..cd8db21acab9 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanCFG.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanCFG.h
@@ -189,9 +189,8 @@ class VPAllSuccessorsIterator
 
   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};


        


More information about the llvm-commits mailing list