Make if-conversion ignore dbg_value instructions in its analysis. rdar://7797940

llvm-svn: 105498
This commit is contained in:
Jim Grosbach 2010-06-04 23:01:26 +00:00
parent 7a41bddd2c
commit 8e3fbf47cb

View File

@ -514,7 +514,15 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI,
MachineBasicBlock::iterator TI = TrueBBI.BB->begin();
MachineBasicBlock::iterator FI = FalseBBI.BB->begin();
while (TI != TrueBBI.BB->end() && FI != FalseBBI.BB->end()) {
while (1) {
// Skip dbg_value instructions
if (TI->isDebugValue())
++TI;
if (FI->isDebugValue())
++FI;
if (TI == TrueBBI.BB->end() || FI == FalseBBI.BB->end())
break;
if (!TI->isIdenticalTo(FI))
break;
++Dups1;
@ -524,7 +532,15 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI,
TI = firstNonBranchInst(TrueBBI.BB, TII);
FI = firstNonBranchInst(FalseBBI.BB, TII);
while (TI != TrueBBI.BB->begin() && FI != FalseBBI.BB->begin()) {
while (1) {
// Skip dbg_value instructions
if (TI->isDebugValue())
--TI;
if (FI->isDebugValue())
--FI;
if (TI == TrueBBI.BB->begin() || FI == FalseBBI.BB->begin())
break;
if (!TI->isIdenticalTo(FI))
break;
++Dups2;
@ -569,6 +585,9 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
BBI.ClobbersPred = false;
for (MachineBasicBlock::iterator I = BBI.BB->begin(), E = BBI.BB->end();
I != E; ++I) {
if (I->isDebugValue())
continue;
const TargetInstrDesc &TID = I->getDesc();
if (TID.isNotDuplicable())
BBI.CannotBeCopied = true;
@ -1137,7 +1156,7 @@ void IfConverter::PredicateBlock(BBInfo &BBI,
MachineBasicBlock::iterator E,
SmallVectorImpl<MachineOperand> &Cond) {
for (MachineBasicBlock::iterator I = BBI.BB->begin(); I != E; ++I) {
if (TII->isPredicated(I))
if (I->isDebugValue() || TII->isPredicated(I))
continue;
if (!TII->PredicateInstruction(I, Cond)) {
#ifndef NDEBUG
@ -1174,7 +1193,7 @@ void IfConverter::CopyAndPredicateBlock(BBInfo &ToBBI, BBInfo &FromBBI,
ToBBI.BB->insert(ToBBI.BB->end(), MI);
ToBBI.NonPredSize++;
if (!isPredicated)
if (!isPredicated && !MI->isDebugValue())
if (!TII->PredicateInstruction(MI, Cond)) {
#ifndef NDEBUG
dbgs() << "Unable to predicate " << *I << "!\n";