[llvm-commits] [llvm] r159061 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jun 22 19:23:00 PDT 2012


Author: stoklund
Date: Fri Jun 22 21:23:00 2012
New Revision: 159061

URL: http://llvm.org/viewvc/llvm-project?rev=159061&view=rev
Log:
Teach LiveVariables to handle <undef> operands.

It's simple: Don't treat <undef> operands as uses, and don't assume a
virtual register has a defining instruction unless a real use has been
seen.

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

Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=159061&r1=159060&r2=159061&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Jun 22 21:23:00 2012
@@ -573,7 +573,8 @@
         unsigned MOReg = MO.getReg();
         if (MO.isUse()) {
           MO.setIsKill(false);
-          UseRegs.push_back(MOReg);
+          if (MO.readsReg())
+            UseRegs.push_back(MOReg);
         } else /*MO.isDef()*/ {
           MO.setIsDead(false);
           DefRegs.push_back(MOReg);
@@ -729,8 +730,9 @@
     for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
          BBI != BBE && BBI->isPHI(); ++BBI)
       for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
-        PHIVarInfo[BBI->getOperand(i + 1).getMBB()->getNumber()]
-          .push_back(BBI->getOperand(i).getReg());
+        if (BBI->getOperand(i).readsReg())
+          PHIVarInfo[BBI->getOperand(i + 1).getMBB()->getNumber()]
+            .push_back(BBI->getOperand(i).getReg());
 }
 
 bool LiveVariables::VarInfo::isLiveIn(const MachineBasicBlock &MBB,





More information about the llvm-commits mailing list