[PATCH] D23939: IfConversion: Fix branch predication bug.
    Kyle Butt via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Aug 26 15:06:53 PDT 2016
    
    
  
iteratee added inline comments.
================
Comment at: lib/CodeGen/IfConversion.cpp:1778
@@ -1782,4 +1777,3 @@
 
-  if (RemoveTrueBranch)
-    BBI1->NonPredSize -= TII->RemoveBranch(*BBI1->BB);
+  BBI1->NonPredSize -= TII->RemoveBranch(*BBI1->BB);
   // Remove duplicated instructions.
----------------
davidxl wrote:
> Is trueBranch always analyzable?
No, but we have previously verified that both blocks have the same branch instructions, so we only need one copy.
================
Comment at: lib/CodeGen/IfConversion.cpp:1807
@@ -1807,1 +1806,3 @@
+    DI2++;
+  }
   while (NumDups2 != 0) {
----------------
davidxl wrote:
> Why  skipping debug value here? Does that affect the NumDups2 adjustment below?
> Does that affect the NumDups2 adjustment below?
No. NumDups2 doesn't count debug values.
Would it be clearer if it read (DI2->isBranch() || DI2->isDebugValue())?
The goal is to skip all the branch instructions, because they have been checked to match MBB1 and don't need to predicated.
This is where the actual crash was occurring. We were attempting to predicate the branch instruction when we didn't need to.
Repository:
  rL LLVM
https://reviews.llvm.org/D23939
    
    
More information about the llvm-commits
mailing list