[llvm] r266471 - [mips] Use range-based for loops and simplify slightly the code. NFC.

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 13:18:49 PDT 2016


Author: vkalintiris
Date: Fri Apr 15 15:18:48 2016
New Revision: 266471

URL: http://llvm.org/viewvc/llvm-project?rev=266471&view=rev
Log:
[mips] Use range-based for loops and simplify slightly the code. NFC.

Modified:
    llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp?rev=266471&r1=266470&r2=266471&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp Fri Apr 15 15:18:48 2016
@@ -220,16 +220,20 @@ void MipsSEDAGToDAGISel::processFunction
 
   MachineRegisterInfo *MRI = &MF.getRegInfo();
 
-  for (MachineFunction::iterator MFI = MF.begin(), MFE = MF.end(); MFI != MFE;
-       ++MFI)
-    for (MachineBasicBlock::iterator I = MFI->begin(); I != MFI->end(); ++I) {
-      if (I->getOpcode() == Mips::RDDSP)
-        addDSPCtrlRegOperands(false, *I, MF);
-      else if (I->getOpcode() == Mips::WRDSP)
-        addDSPCtrlRegOperands(true, *I, MF);
-      else
-        replaceUsesWithZeroReg(MRI, *I);
+  for (auto &MBB: MF) {
+    for (auto &MI: MBB) {
+      switch (MI.getOpcode()) {
+      case Mips::RDDSP:
+        addDSPCtrlRegOperands(false, MI, MF);
+        break;
+      case Mips::WRDSP:
+        addDSPCtrlRegOperands(true, MI, MF);
+        break;
+      default:
+        replaceUsesWithZeroReg(MRI, MI);
+      }
     }
+  }
 }
 
 SDNode *MipsSEDAGToDAGISel::selectAddESubE(unsigned MOp, SDValue InFlag,




More information about the llvm-commits mailing list