diff options
| author | Dale Johannesen <dalej@apple.com> | 2010-02-16 01:57:28 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2010-02-16 01:57:28 +0000 |
| commit | d7eb69364310c32a5ca5d7dc943abeb84b74c2d7 (patch) | |
| tree | 32c1a0e56fc38e6a1d4f0eeedd38f199881bdcdf /llvm | |
| parent | ce79bc9c7a3b374de6f4a7796ab525b7559868f2 (diff) | |
| download | bcm5719-llvm-d7eb69364310c32a5ca5d7dc943abeb84b74c2d7.tar.gz bcm5719-llvm-d7eb69364310c32a5ca5d7dc943abeb84b74c2d7.zip | |
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.
llvm-svn: 96318
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/PHIElimination.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.h b/llvm/lib/CodeGen/PHIElimination.h index 895aaa4115d..f3ab9e27dbf 100644 --- a/llvm/lib/CodeGen/PHIElimination.h +++ b/llvm/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; } |

