[llvm-commits] [llvm] r122537 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Cameron Zwarich zwarich at apple.com
Thu Dec 23 19:09:36 PST 2010


Author: zwarich
Date: Thu Dec 23 21:09:36 2010
New Revision: 122537

URL: http://llvm.org/viewvc/llvm-project?rev=122537&view=rev
Log:
Simplify a check for implicit defs and remove a FIXME.

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

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=122537&r1=122536&r2=122537&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Thu Dec 23 21:09:36 2010
@@ -189,20 +189,18 @@
   SmallPtrSet<MachineBasicBlock*, 8> MBBsInsertedInto;
   for (unsigned i = 1; i < PHI->getNumOperands(); i += 2) {
     MachineOperand& SrcMO = PHI->getOperand(i);
+
+    // If a source is defined by an implicit def, there is no need to insert a
+    // copy in the predecessor.
+    if (SrcMO.isUndef())
+      continue;
+
     unsigned SrcReg = SrcMO.getReg();
     unsigned SrcSubReg = SrcMO.getSubReg();
 
     assert(TargetRegisterInfo::isVirtualRegister(SrcReg) &&
            "Machine PHI Operands must all be virtual registers!");
 
-    // If source is defined by an implicit def, there is no need to insert a
-    // copy.
-    // FIXME: For some reason, if LiveIntervals is run prior to PHI elimination
-    // implcit defs have no defining instruction. Is this expected?
-    MachineInstr* DefMI = MRI->getVRegDef(SrcReg);
-    if (!DefMI)
-      continue;
-
     MachineBasicBlock* PredBB = PHI->getOperand(i + 1).getMBB();
 
     // A copy may have already been inserted in the predecessor in the case of a





More information about the llvm-commits mailing list