[llvm] 10b1c29 - [CodeGen] Use a range-based for loop (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 14 12:18:03 PST 2024


Author: Kazu Hirata
Date: 2024-01-14T12:17:54-08:00
New Revision: 10b1c29e396ffb83b0da989740382d5db14fcd9c

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

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 6d80b282a1ed21..d213ea89de13b6 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -2210,15 +2210,12 @@ Register FastISel::fastEmitZExtFromI1(MVT VT, unsigned Op0) {
 /// might result in multiple MBB's for one BB.  As such, the start of the
 /// BB might correspond to a 
diff erent MBB than the end.
 bool FastISel::handlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB) {
-  const Instruction *TI = LLVMBB->getTerminator();
-
   SmallPtrSet<MachineBasicBlock *, 4> SuccsHandled;
   FuncInfo.OrigNumPHINodesToUpdate = FuncInfo.PHINodesToUpdate.size();
 
   // Check successor nodes' PHI nodes that expect a constant to be available
   // from this block.
-  for (unsigned succ = 0, e = TI->getNumSuccessors(); succ != e; ++succ) {
-    const BasicBlock *SuccBB = TI->getSuccessor(succ);
+  for (const BasicBlock *SuccBB : successors(LLVMBB)) {
     if (!isa<PHINode>(SuccBB->begin()))
       continue;
     MachineBasicBlock *SuccMBB = FuncInfo.MBBMap[SuccBB];


        


More information about the llvm-commits mailing list