[llvm] 6332c36 - [AMDGPU] Use range-based for loops (NFC) (#106328)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 01:13:37 PDT 2024


Author: Kazu Hirata
Date: 2024-08-28T01:13:33-07:00
New Revision: 6332c36bc846e7cba5c8cc1f865ca506539692fc

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

LOG: [AMDGPU] Use range-based for loops (NFC) (#106328)

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/R600InstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/R600InstrInfo.cpp b/llvm/lib/Target/AMDGPU/R600InstrInfo.cpp
index d826ae8c5da23a..0528f9c9e12aff 100644
--- a/llvm/lib/Target/AMDGPU/R600InstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/R600InstrInfo.cpp
@@ -75,12 +75,9 @@ void R600InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
 /// \returns true if \p MBBI can be moved into a new basic.
 bool R600InstrInfo::isLegalToSplitMBBAt(MachineBasicBlock &MBB,
                                        MachineBasicBlock::iterator MBBI) const {
-  for (MachineInstr::const_mop_iterator I = MBBI->operands_begin(),
-                                        E = MBBI->operands_end(); I != E; ++I) {
-    if (I->isReg() && !I->getReg().isVirtual() && I->isUse() &&
-        RI.isPhysRegLiveAcrossClauses(I->getReg()))
+  for (const MachineOperand &MO : MBBI->all_uses())
+    if (!MO.getReg().isVirtual() && RI.isPhysRegLiveAcrossClauses(MO.getReg()))
       return false;
-  }
   return true;
 }
 
@@ -219,15 +216,10 @@ bool R600InstrInfo::readsLDSSrcReg(const MachineInstr &MI) const {
   if (!isALUInstr(MI.getOpcode())) {
     return false;
   }
-  for (MachineInstr::const_mop_iterator I = MI.operands_begin(),
-                                        E = MI.operands_end();
-       I != E; ++I) {
-    if (!I->isReg() || !I->isUse() || I->getReg().isVirtual())
-      continue;
-
-    if (R600::R600_LDS_SRC_REGRegClass.contains(I->getReg()))
+  for (const MachineOperand &MO : MI.all_uses())
+    if (MO.getReg().isPhysical() &&
+        R600::R600_LDS_SRC_REGRegClass.contains(MO.getReg()))
       return true;
-  }
   return false;
 }
 


        


More information about the llvm-commits mailing list