mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106323 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e03262fcfc
commit
a9934dc20a
@ -531,6 +531,19 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI,
|
|||||||
while (FI != FIE && FI->isDebugValue())
|
while (FI != FIE && FI->isDebugValue())
|
||||||
++FI;
|
++FI;
|
||||||
while (TI != TIE && FI != FIE) {
|
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))
|
if (!TI->isIdenticalTo(FI))
|
||||||
break;
|
break;
|
||||||
++Dups1;
|
++Dups1;
|
||||||
@ -542,12 +555,25 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI,
|
|||||||
FI = firstNonBranchInst(FalseBBI.BB, TII);
|
FI = firstNonBranchInst(FalseBBI.BB, TII);
|
||||||
MachineBasicBlock::iterator TIB = TrueBBI.BB->begin();
|
MachineBasicBlock::iterator TIB = TrueBBI.BB->begin();
|
||||||
MachineBasicBlock::iterator FIB = FalseBBI.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())
|
while (TI != TIB && TI->isDebugValue())
|
||||||
--TI;
|
--TI;
|
||||||
while (FI != FIB && FI->isDebugValue())
|
while (FI != FIB && FI->isDebugValue())
|
||||||
--FI;
|
--FI;
|
||||||
while (TI != TIB && FI != FIB) {
|
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))
|
if (!TI->isIdenticalTo(FI))
|
||||||
break;
|
break;
|
||||||
++Dups2;
|
++Dups2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user