[llvm-commits] [llvm] r106512 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp

Dan Gohman gohman at apple.com
Mon Jun 21 17:32:04 PDT 2010


Author: djg
Date: Mon Jun 21 19:32:04 2010
New Revision: 106512

URL: http://llvm.org/viewvc/llvm-project?rev=106512&view=rev
Log:
Fix the new load-unfolding code to update LiveVariable's dead flags,
in addition to the kill flags.

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

Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=106512&r1=106511&r2=106512&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Jun 21 19:32:04 2010
@@ -961,8 +961,14 @@
           if (LV) {
             for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) {
               MachineOperand &MO = mi->getOperand(i);
-              if (MO.isReg() && MO.isUse() && MO.isKill())
-                LV->replaceKillInstruction(Reg, mi, NewMIs[0]);
+              if (MO.isReg() && MO.getReg() != 0 &&
+                  TargetRegisterInfo::isVirtualRegister(MO.getReg())) {
+                if (MO.isUse()) {
+                  if (MO.isKill())
+                    LV->replaceKillInstruction(MO.getReg(), mi, NewMIs[0]);
+                } else if (LV->removeVirtualRegisterDead(MO.getReg(), mi))
+                  LV->addVirtualRegisterDead(MO.getReg(), NewMIs[1]);
+              }
             }
             LV->addVirtualRegisterKilled(Reg, NewMIs[1]);
           }





More information about the llvm-commits mailing list