aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2010-12-24 03:09:36 +0000
committerCameron Zwarich <zwarich@apple.com>2010-12-24 03:09:36 +0000
commitef485d86585123b5e31a7f88aef22725ebd07e7a (patch)
treee0109ec29f8822828cbd59b6ee87daef0e74f010
parentd82ed5b7347173a827969966db740c2b34d605b9 (diff)
Simplify a check for implicit defs and remove a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122537 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index b475432bcf..a0ad2fb0c0 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/lib/CodeGen/StrongPHIElimination.cpp
@@ -189,20 +189,18 @@ void StrongPHIElimination::InsertCopiesForPHI(MachineInstr* PHI,
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