summaryrefslogtreecommitdiff
path: root/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-06-14 21:30:32 +0000
committerJim Grosbach <grosbach@apple.com>2010-06-14 21:30:32 +0000
commitc834f413ae9bfd6d41545aed8d6b91c8ccb8ea16 (patch)
tree37079726c00fec2c04d8e71ca86e12c5377f5e66 /lib/CodeGen/IfConversion.cpp
parent38a979bf95db020094769194651b91291ca0220c (diff)
downloadllvm-c834f413ae9bfd6d41545aed8d6b91c8ccb8ea16.tar.gz
llvm-c834f413ae9bfd6d41545aed8d6b91c8ccb8ea16.tar.bz2
llvm-c834f413ae9bfd6d41545aed8d6b91c8ccb8ea16.tar.xz
More dbg_value cleanup so the presence of debug info doesn't affect code-gen.
Make sure to skip the dbg_value instructions when moving dups out of the diamond. rdar://7797940 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r--lib/CodeGen/IfConversion.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 7fa07daf9c..daf4e7898c 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -1091,6 +1091,13 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
// Remove the duplicated instructions at the beginnings of both paths.
MachineBasicBlock::iterator DI1 = BBI1->BB->begin();
MachineBasicBlock::iterator DI2 = BBI2->BB->begin();
+ MachineBasicBlock::iterator DIE1 = BBI1->BB->end();
+ MachineBasicBlock::iterator DIE2 = BBI2->BB->end();
+ // Skip dbg_value instructions
+ while (DI1 != DIE1 && DI1->isDebugValue())
+ ++DI1;
+ while (DI2 != DIE2 && DI2->isDebugValue())
+ ++DI2;
BBI1->NonPredSize -= NumDups1;
BBI2->NonPredSize -= NumDups1;
while (NumDups1 != 0) {
@@ -1104,8 +1111,15 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
// Predicate the 'true' block after removing its branch.
BBI1->NonPredSize -= TII->RemoveBranch(*BBI1->BB);
DI1 = BBI1->BB->end();
- for (unsigned i = 0; i != NumDups2; ++i)
+ for (unsigned i = 0; i != NumDups2; ) {
+ // NumDups2 only counted non-dbg_value instructions, so this won't
+ // run off the head of the list.
+ assert (DI1 != BBI1->BB->begin());
--DI1;
+ // skip dbg_value instructions
+ if (!DI1->isDebugValue())
+ ++i;
+ }
BBI1->BB->erase(DI1, BBI1->BB->end());
PredicateBlock(*BBI1, BBI1->BB->end(), *Cond1);
@@ -1113,8 +1127,13 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
BBI2->NonPredSize -= TII->RemoveBranch(*BBI2->BB);
DI2 = BBI2->BB->end();
while (NumDups2 != 0) {
+ // NumDups2 only counted non-dbg_value instructions, so this won't
+ // run off the head of the list.
+ assert (DI2 != BBI2->BB->begin());
--DI2;
- --NumDups2;
+ // skip dbg_value instructions
+ if (!DI2->isDebugValue())
+ --NumDups2;
}
PredicateBlock(*BBI2, DI2, *Cond2);