summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PHIElimination.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-14 06:33:45 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-14 06:33:45 +0000
commit04223909b74fd0634ba26d434fa7fdf2f3c7444f (patch)
treefc27b80cff959412dfb50792890b1337ff450b29 /lib/CodeGen/PHIElimination.cpp
parentd357e88740686e41e9f7fa208887336eb9af3c47 (diff)
downloadllvm-04223909b74fd0634ba26d434fa7fdf2f3c7444f.tar.gz
llvm-04223909b74fd0634ba26d434fa7fdf2f3c7444f.tar.bz2
llvm-04223909b74fd0634ba26d434fa7fdf2f3c7444f.tar.xz
Try for the third time to teach getFirstTerminator() about debug values.
This time let's rephrase to trick gcc-4.3 into not miscompiling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PHIElimination.cpp')
-rw-r--r--lib/CodeGen/PHIElimination.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 923fa213e7..b940e26911 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/lib/CodeGen/PHIElimination.cpp
@@ -339,6 +339,8 @@ void PHIElimination::LowerAtomicPHINode(
#ifndef NDEBUG
for (MachineBasicBlock::iterator TI = llvm::next(Term);
TI != opBlock.end(); ++TI) {
+ if (TI->isDebugValue())
+ continue;
assert(!TI->readsRegister(SrcReg) &&
"Terminator instructions cannot use virtual registers unless"
"they are the first terminator in a block!");
@@ -347,9 +349,13 @@ void PHIElimination::LowerAtomicPHINode(
} else if (reusedIncoming || !IncomingReg) {
// We may have to rewind a bit if we didn't insert a copy this time.
KillInst = Term;
- while (KillInst != opBlock.begin())
- if ((--KillInst)->readsRegister(SrcReg))
+ while (KillInst != opBlock.begin()) {
+ --KillInst;
+ if (KillInst->isDebugValue())
+ continue;
+ if (KillInst->readsRegister(SrcReg))
break;
+ }
} else {
// We just inserted this copy.
KillInst = prior(InsertPos);