[llvm-branch-commits] [llvm-branch] r105967 - in /llvm/branches/Apple/Troughton: ./ lib/CodeGen/IfConversion.cpp

Jim Grosbach grosbach at apple.com
Mon Jun 14 14:39:26 PDT 2010


Author: grosbach
Date: Mon Jun 14 16:39:26 2010
New Revision: 105967

URL: http://llvm.org/viewvc/llvm-project?rev=105967&view=rev
Log:
merge 105965

Modified:
    llvm/branches/Apple/Troughton/   (props changed)
    llvm/branches/Apple/Troughton/lib/CodeGen/IfConversion.cpp

Propchange: llvm/branches/Apple/Troughton/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 16:39:26 2010
@@ -1 +1 @@
-/llvm/trunk:105358,105361,105369,105372,105399,105427,105437,105439,105441,105470,105481,105498,105541,105554,105557,105585-105586,105634,105653,105669,105677,105745,105774-105775,105836,105845,105862,105938,105959
+/llvm/trunk:105358,105361,105369,105372,105399,105427,105437,105439,105441,105470,105481,105498,105541,105554,105557,105585-105586,105634,105653,105669,105677,105745,105774-105775,105836,105845,105862,105938,105959,105965

Modified: llvm/branches/Apple/Troughton/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Troughton/lib/CodeGen/IfConversion.cpp?rev=105967&r1=105966&r2=105967&view=diff
==============================================================================
--- llvm/branches/Apple/Troughton/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/branches/Apple/Troughton/lib/CodeGen/IfConversion.cpp Mon Jun 14 16:39:26 2010
@@ -1091,6 +1091,13 @@
   // 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 @@
   // 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 @@
   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);
 





More information about the llvm-branch-commits mailing list