MachineCSE: Hoist isConstantPhysReg out of the loop, it checks for overlaps already.

llvm-svn: 161729
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index 993975e..896461f 100644
--- a/llvm/lib/CodeGen/MachineCSE.cpp
+++ b/llvm/lib/CodeGen/MachineCSE.cpp
@@ -215,11 +215,10 @@
     if (MO.isDef() &&
         (MO.isDead() || isPhysDefTriviallyDead(Reg, I, MBB->end())))
       continue;
-    for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
-      // Reading constant physregs is ok.
-      if (!MRI->isConstantPhysReg(*AI, *MBB->getParent()))
+    // Reading constant physregs is ok.
+    if (!MRI->isConstantPhysReg(Reg, *MBB->getParent()))
+      for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI)
         PhysRefs.insert(*AI);
-    }
     if (MO.isDef())
       PhysDefs.push_back(Reg);
   }