[llvm-commits] CVS: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Mon Feb 2 15:57:01 PST 2004


Changes in directory llvm/lib/CodeGen:

TwoAddressInstructionPass.cpp updated: 1.9 -> 1.10

---
Log message:

Correctly update def/use information for modified machine operands.


---
Diffs of the changes:  (+9 -3)

Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.9 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.10
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.9	Sat Jan 31 15:21:43 2004
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp	Mon Feb  2 15:56:40 2004
@@ -146,11 +146,17 @@
                 LV.addVirtualRegisterDead(regB, &*mbbi, prevMi);
 
             // replace all occurences of regB with regA
+            // and mark all uses and defs of regA as def&use
             for (unsigned i = 1; i < mi->getNumOperands(); ++i) {
-                if (mi->getOperand(i).isRegister() &&
-                    mi->getOperand(i).getReg() == regB)
-                    mi->SetMachineOperandReg(i, regA);
+                MachineOperand& op = mi->getOperand(i);
+                if (op.isRegister()) {
+                    if (op.getReg() == regB)
+                        mi->SetMachineOperandReg(i, regA);
+                    if (op.getReg() == regA)
+                        op.setDef().setUse();
+                }
             }
+
             DEBUG(std::cerr << "\t\tmodified original to: ";
                   mi->print(std::cerr, TM));
             assert(mi->getOperand(0).getAllocatedRegNum() ==





More information about the llvm-commits mailing list