[llvm] 687136e - [Transforms] Use a range-based for loop (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 27 22:20:36 PST 2024


Author: Kazu Hirata
Date: 2024-01-27T22:20:25-08:00
New Revision: 687136e7cd2ba897dc1f3688af6db58549ab95f2

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

LOG: [Transforms] Use a range-based for loop (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/PredicateInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp
index 902977b08d15379..186e17e166ba3d1 100644
--- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp
+++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp
@@ -478,10 +478,8 @@ void PredicateInfoBuilder::processSwitch(
 
   // Remember how many outgoing edges there are to every successor.
   SmallDenseMap<BasicBlock *, unsigned, 16> SwitchEdges;
-  for (unsigned i = 0, e = SI->getNumSuccessors(); i != e; ++i) {
-    BasicBlock *TargetBlock = SI->getSuccessor(i);
+  for (BasicBlock *TargetBlock : successors(BranchBB))
     ++SwitchEdges[TargetBlock];
-  }
 
   // Now propagate info for each case value
   for (auto C : SI->cases()) {


        


More information about the llvm-commits mailing list