[llvm-commits] [llvm] r53389 - /llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Owen Anderson resistor at mac.com
Wed Jul 9 18:53:01 PDT 2008


Author: resistor
Date: Wed Jul  9 20:53:01 2008
New Revision: 53389

URL: http://llvm.org/viewvc/llvm-project?rev=53389&view=rev
Log:
Fix 403.gcc.  Finally got the check for two-address-ness correct.

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

Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=53389&r1=53388&r2=53389&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Wed Jul  9 20:53:01 2008
@@ -589,20 +589,24 @@
         std::map<unsigned, std::pair<MachineInstr*, unsigned> >::iterator
           last = LastUseDef.find(MO.getReg());
         if (last != LastUseDef.end()) {
-          
-          // If this is a two address instr, then we don't mark the def
-          // as killing the use.
-          if (last->second.first == I &&
-              I->getDesc().getOperandConstraint(last->second.second,
-                                                TOI::TIED_TO) == (signed)i) {
-            LastUseDef[MO.getReg()] = std::make_pair(I, i);
-            continue;
+          // Check if this is a two address instruction.  If so, then
+          // the def does not kill the use.
+          if (last->second.first == I) {
+            bool isTwoAddr = false;
+            for (unsigned j = i+1, je = I->getDesc().getNumOperands();
+                j < je; ++j) {
+              const MachineOperand &MO2 = I->getOperand(j);
+              if (MO2.isRegister() && MO2.isUse() &&
+                  MO2.getReg() == MO.getReg() &&
+                  I->getDesc().getOperandConstraint(j, TOI::TIED_TO) == (int)i)
+                isTwoAddr = true;
+            }
+
+            if (isTwoAddr) continue;
           }
-            
           
           MachineOperand& lastUD =
                       last->second.first->getOperand(last->second.second);
-          
           if (lastUD.isDef())
             lastUD.setIsDead(true);
           else if (lastUD.isUse())





More information about the llvm-commits mailing list