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

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 19 09:09:28 PST 2005



Changes in directory llvm/lib/CodeGen:

LiveVariables.cpp updated: 1.45 -> 1.46
---
Log message:

When an instruction moves, make sure to update the VarInfo::Kills list as
well as all of teh other stuff in livevar. This fixes the compiler crash
on fourinarow last night.


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

Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.45 llvm/lib/CodeGen/LiveVariables.cpp:1.46
--- llvm/lib/CodeGen/LiveVariables.cpp:1.45	Mon Oct 25 13:44:14 2004
+++ llvm/lib/CodeGen/LiveVariables.cpp	Wed Jan 19 11:09:15 2005
@@ -302,12 +302,19 @@
   // the instruction.
   for (unsigned i = 0, e = OldMI->getNumOperands(); i != e; ++i) {
     MachineOperand &MO = OldMI->getOperand(i);
-    if (MO.isRegister() && MO.isDef() && MO.getReg() &&
+    if (MO.isRegister() && MO.getReg() &&
         MRegisterInfo::isVirtualRegister(MO.getReg())) {
       unsigned Reg = MO.getReg();
       VarInfo &VI = getVarInfo(Reg);
-      if (VI.DefInst == OldMI)
-        VI.DefInst = NewMI;
+      if (MO.isDef()) {
+        // Update the defining instruction.
+        if (VI.DefInst == OldMI)
+          VI.DefInst = NewMI;
+      } else if (MO.isUse()) {
+        // If this is a kill of the value, update the VI kills list.
+        if (VI.removeKill(OldMI))
+          VI.Kills.push_back(NewMI);   // Yes, there was a kill of it
+      }
     }
   }
 






More information about the llvm-commits mailing list