[llvm-commits] [llvm] r161729 - /llvm/trunk/lib/CodeGen/MachineCSE.cpp

Benjamin Kramer benny.kra at googlemail.com
Sat Aug 11 13:42:59 PDT 2012


Author: d0k
Date: Sat Aug 11 15:42:59 2012
New Revision: 161729

URL: http://llvm.org/viewvc/llvm-project?rev=161729&view=rev
Log:
MachineCSE: Hoist isConstantPhysReg out of the loop, it checks for overlaps already.

Modified:
    llvm/trunk/lib/CodeGen/MachineCSE.cpp

Modified: llvm/trunk/lib/CodeGen/MachineCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCSE.cpp?rev=161729&r1=161728&r2=161729&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCSE.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCSE.cpp Sat Aug 11 15:42:59 2012
@@ -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);
   }





More information about the llvm-commits mailing list