[llvm] r281500 - [LoopInterchange] Add CL option to override cost threshold.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 10:07:13 PDT 2016


Author: mcrosier
Date: Wed Sep 14 12:07:13 2016
New Revision: 281500

URL: http://llvm.org/viewvc/llvm-project?rev=281500&view=rev
Log:
[LoopInterchange] Add CL option to override cost threshold.

Mostly useful for getting consistent lit testing.

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

Modified: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=281500&r1=281499&r2=281500&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp Wed Sep 14 12:07:13 2016
@@ -44,6 +44,10 @@ using namespace llvm;
 
 #define DEBUG_TYPE "loop-interchange"
 
+static cl::opt<int> LoopInterchangeCostThreshold(
+    "loop-interchange-threshold", cl::init(0), cl::Hidden,
+    cl::desc("Interchange if you gain more than this number"));
+
 namespace {
 
 typedef SmallVector<Loop *, 8> LoopVector;
@@ -975,10 +979,9 @@ bool LoopInterchangeProfitability::isPro
   // This is rough cost estimation algorithm. It counts the good and bad order
   // of induction variables in the instruction and allows reordering if number
   // of bad orders is more than good.
-  int Cost = 0;
-  Cost += getInstrOrderCost();
+  int Cost = getInstrOrderCost();
   DEBUG(dbgs() << "Cost = " << Cost << "\n");
-  if (Cost < 0)
+  if (Cost < -LoopInterchangeCostThreshold)
     return true;
 
   // It is not profitable as per current cache profitability model. But check if




More information about the llvm-commits mailing list