From 1e694f09c9d76a7f53705b581eba537284e03480 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Wed, 14 Sep 2016 17:07:13 +0000 Subject: [PATCH] [LoopInterchange] Add CL option to override cost threshold. Mostly useful for getting consistent lit testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281500 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopInterchange.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Scalar/LoopInterchange.cpp b/lib/Transforms/Scalar/LoopInterchange.cpp index 2f282e8ccf3..1e091bacd40 100644 --- a/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/lib/Transforms/Scalar/LoopInterchange.cpp @@ -44,6 +44,10 @@ using namespace llvm; #define DEBUG_TYPE "loop-interchange" +static cl::opt LoopInterchangeCostThreshold( + "loop-interchange-threshold", cl::init(0), cl::Hidden, + cl::desc("Interchange if you gain more than this number")); + namespace { typedef SmallVector LoopVector; @@ -975,10 +979,9 @@ bool LoopInterchangeProfitability::isProfitable(unsigned InnerLoopId, // 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 -- 2.50.1