[llvm-commits] [llvm] r96318 - /llvm/trunk/lib/CodeGen/PHIElimination.h
Dale Johannesen
dalej at apple.com
Mon Feb 15 17:57:29 PST 2010
Author: johannes
Date: Mon Feb 15 19:57:28 2010
New Revision: 96318
URL: http://llvm.org/viewvc/llvm-project?rev=96318&view=rev
Log:
Handle DBG_VALUE mixed with labels when doing PHI
elimination. Before a DBG_VALUE could affect codegen.
The solution here is imperfect and not final.
Modified:
llvm/trunk/lib/CodeGen/PHIElimination.h
Modified: llvm/trunk/lib/CodeGen/PHIElimination.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.h?rev=96318&r1=96317&r2=96318&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PHIElimination.h (original)
+++ llvm/trunk/lib/CodeGen/PHIElimination.h Mon Feb 15 19:57:28 2010
@@ -109,12 +109,29 @@
// SkipPHIsAndLabels - Copies need to be inserted after phi nodes and
// also after any exception handling labels: in landing pads execution
// starts at the label, so any copies placed before it won't be executed!
+ // We also deal with DBG_VALUEs, which are a bit tricky:
+ // PHI
+ // DBG_VALUE
+ // LABEL
+ // Here the DBG_VALUE needs to be skipped, and if it refers to a PHI it
+ // needs to be annulled or, better, moved to follow the label, as well.
+ // PHI
+ // DBG_VALUE
+ // no label
+ // Here it is not a good idea to skip the DBG_VALUE.
+ // FIXME: For now we skip and annul all DBG_VALUEs, maximally simple and
+ // maximally stupid.
MachineBasicBlock::iterator SkipPHIsAndLabels(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I) {
// Rather than assuming that EH labels come before other kinds of labels,
// just skip all labels.
- while (I != MBB.end() && (I->isPHI() || I->isLabel()))
+ while (I != MBB.end() &&
+ (I->isPHI() || I->isLabel() || I->isDebugValue())) {
+ if (I->isDebugValue() && I->getNumOperands()==3 &&
+ I->getOperand(0).isReg())
+ I->getOperand(0).setReg(0U);
++I;
+ }
return I;
}
More information about the llvm-commits
mailing list