summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PHIElimination.h
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-02-16 01:57:28 +0000
committerDale Johannesen <dalej@apple.com>2010-02-16 01:57:28 +0000
commit6e303cb9fa5fdf93a09b8b6017658f3c72a21292 (patch)
treeb53c159843b52f417f3813c7b822757fdf80847a /lib/CodeGen/PHIElimination.h
parenta3b1119977857c7e424f83b25b7e1c7c00783429 (diff)
downloadllvm-6e303cb9fa5fdf93a09b8b6017658f3c72a21292.tar.gz
llvm-6e303cb9fa5fdf93a09b8b6017658f3c72a21292.tar.bz2
llvm-6e303cb9fa5fdf93a09b8b6017658f3c72a21292.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PHIElimination.h')
-rw-r--r--lib/CodeGen/PHIElimination.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/CodeGen/PHIElimination.h b/lib/CodeGen/PHIElimination.h
index 895aaa4115..f3ab9e27db 100644
--- a/lib/CodeGen/PHIElimination.h
+++ b/lib/CodeGen/PHIElimination.h
@@ -109,12 +109,29 @@ namespace llvm {
// 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;
}