summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-06-18 21:52:57 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-06-18 21:52:57 +0000
commitc0e0d85b18d7724aa8a0914dd47a321e94648c42 (patch)
tree01e62ceed1b6096c1941ac7e6eb4c86e2f67f745 /llvm/lib/CodeGen
parentef5f6212150d1f148f9b15ec0d2ba6cd08701752 (diff)
downloadbcm5719-llvm-c0e0d85b18d7724aa8a0914dd47a321e94648c42.tar.gz
bcm5719-llvm-c0e0d85b18d7724aa8a0914dd47a321e94648c42.zip
Teach iff-converter to properly count # of dups. It was not skipping over dbg_value's which resulted in non-duplicated instructions being deleted. rdar://8104384.
llvm-svn: 106323
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/IfConversion.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp
index f82b2f09f36..dad52184b0e 100644
--- a/llvm/lib/CodeGen/IfConversion.cpp
+++ b/llvm/lib/CodeGen/IfConversion.cpp
@@ -531,6 +531,19 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI,
while (FI != FIE && FI->isDebugValue())
++FI;
while (TI != TIE && FI != FIE) {
+ // Skip dbg_value instructions. These do not count.
+ if (TI->isDebugValue()) {
+ while (TI != TIE && TI->isDebugValue())
+ ++TI;
+ if (TI == TIE)
+ break;
+ }
+ if (FI->isDebugValue()) {
+ while (FI != FIE && FI->isDebugValue())
+ ++FI;
+ if (FI == FIE)
+ break;
+ }
if (!TI->isIdenticalTo(FI))
break;
++Dups1;
@@ -542,12 +555,25 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI,
FI = firstNonBranchInst(FalseBBI.BB, TII);
MachineBasicBlock::iterator TIB = TrueBBI.BB->begin();
MachineBasicBlock::iterator FIB = FalseBBI.BB->begin();
- // Skip dbg_value instructions
+ // Skip dbg_value instructions at end of the bb's.
while (TI != TIB && TI->isDebugValue())
--TI;
while (FI != FIB && FI->isDebugValue())
--FI;
while (TI != TIB && FI != FIB) {
+ // Skip dbg_value instructions. These do not count.
+ if (TI->isDebugValue()) {
+ while (TI != TIB && TI->isDebugValue())
+ --TI;
+ if (TI == TIB)
+ break;
+ }
+ if (FI->isDebugValue()) {
+ while (FI != FIB && FI->isDebugValue())
+ --FI;
+ if (FI == FIB)
+ break;
+ }
if (!TI->isIdenticalTo(FI))
break;
++Dups2;
OpenPOWER on IntegriCloud