[llvm-commits] [llvm] r105498 - /llvm/trunk/lib/CodeGen/IfConversion.cpp
Jim Grosbach
grosbach at apple.com
Fri Jun 4 16:01:26 PDT 2010
Author: grosbach
Date: Fri Jun 4 18:01:26 2010
New Revision: 105498
URL: http://llvm.org/viewvc/llvm-project?rev=105498&view=rev
Log:
Make if-conversion ignore dbg_value instructions in its analysis. rdar://7797940
Modified:
llvm/trunk/lib/CodeGen/IfConversion.cpp
Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=105498&r1=105497&r2=105498&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Fri Jun 4 18:01:26 2010
@@ -514,7 +514,15 @@
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 @@
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 @@
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 @@
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 @@
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";
More information about the llvm-commits
mailing list