[llvm] r351193 - [SimpleLoopUnswitch] Increment stats counter for unswitching switch instruction

Zaara Syeda via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 07:08:01 PST 2019


Author: syzaara
Date: Tue Jan 15 07:08:01 2019
New Revision: 351193

URL: http://llvm.org/viewvc/llvm-project?rev=351193&view=rev
Log:
[SimpleLoopUnswitch] Increment stats counter for unswitching switch instruction

Increment statistics counter NumSwitches at unswitchNontrivialInvariants() for
unswitching a non-trivial switch instruction. This is to fix a bug that it
increments NumBranches even for the case of switch instruction.
There is no functional change in this patch.

Differential Revision: https://reviews.llvm.org/D56408

Modified:
    llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp?rev=351193&r1=351192&r2=351193&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp Tue Jan 15 07:08:01 2019
@@ -2281,7 +2281,10 @@ static void unswitchNontrivialInvariants
   if (MSSAU && VerifyMemorySSA)
     MSSAU->getMemorySSA()->verifyMemorySSA();
 
-  ++NumBranches;
+  if (BI)
+    ++NumBranches;
+  else
+    ++NumSwitches;
 }
 
 /// Recursively compute the cost of a dominator subtree based on the per-block




More information about the llvm-commits mailing list