[llvm] r280448 - IfConversion: Don't count branches in # of duplicates.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 18:20:06 PDT 2016


Author: iteratee
Date: Thu Sep  1 20:20:06 2016
New Revision: 280448

URL: http://llvm.org/viewvc/llvm-project?rev=280448&view=rev
Log:
IfConversion: Don't count branches in # of duplicates.

If the entire blocks match, we would count the branch instructions
toward the number of duplicated instructions. This doesn't match what we
do elsewhere, and was causing a bug.

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=280448&r1=280447&r2=280448&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Thu Sep  1 20:20:06 2016
@@ -671,7 +671,9 @@ bool IfConverter::CountDuplicatedInstruc
     std::vector<MachineOperand> PredDefs;
     if (TII->DefinesPredicate(*TIB, PredDefs))
       return false;
-    ++Dups1;
+    // If we get all the way to the branch instructions, don't count them.
+    if (!TIB->isBranch())
+      ++Dups1;
     ++TIB;
     ++FIB;
   }




More information about the llvm-commits mailing list