[llvm] r179162 - Cleanup PPCInstrInfo::DefinesPredicate

Hal Finkel hfinkel at anl.gov
Wed Apr 10 00:17:47 PDT 2013


Author: hfinkel
Date: Wed Apr 10 02:17:47 2013
New Revision: 179162

URL: http://llvm.org/viewvc/llvm-project?rev=179162&view=rev
Log:
Cleanup PPCInstrInfo::DefinesPredicate

Implement suggestions made by Bill Schmidt in post-commit review. Thanks!

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=179162&r1=179161&r2=179162&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Wed Apr 10 02:17:47 2013
@@ -1003,15 +1003,20 @@ bool PPCInstrInfo::DefinesPredicate(Mach
   bool Found = false;
   for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = MI->getOperand(i);
-    for (int c = 0; c < 2 && !Found; ++c) {
+    for (unsigned c = 0; c < array_lengthof(RCs) && !Found; ++c) {
       const TargetRegisterClass *RC = RCs[c];
-      for (TargetRegisterClass::iterator I = RC->begin(),
-           IE = RC->end(); I != IE; ++I) {
-        if ((MO.isRegMask() && MO.clobbersPhysReg(*I)) ||
-            (MO.isReg() && MO.isDef() && MO.getReg() == *I)) {
+      if (MO.isReg()) {
+        if (MO.isDef() && RC->contains(MO.getReg())) {
           Pred.push_back(MO);
           Found = true;
         }
+      } else if (MO.isRegMask()) {
+        for (TargetRegisterClass::iterator I = RC->begin(),
+             IE = RC->end(); I != IE; ++I)
+          if (MO.clobbersPhysReg(*I)) {
+            Pred.push_back(MO);
+            Found = true;
+          }
       }
     }
   }





More information about the llvm-commits mailing list