Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 1e694f0

Browse files
author
Chad Rosier
committed
[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
1 parent e65dbf0 commit 1e694f0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/Transforms/Scalar/LoopInterchange.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ using namespace llvm;
4444

4545
#define DEBUG_TYPE "loop-interchange"
4646

47+
static cl::opt<int> LoopInterchangeCostThreshold(
48+
"loop-interchange-threshold", cl::init(0), cl::Hidden,
49+
cl::desc("Interchange if you gain more than this number"));
50+
4751
namespace {
4852

4953
typedef SmallVector<Loop *, 8> LoopVector;
@@ -975,10 +979,9 @@ bool LoopInterchangeProfitability::isProfitable(unsigned InnerLoopId,
975979
// This is rough cost estimation algorithm. It counts the good and bad order
976980
// of induction variables in the instruction and allows reordering if number
977981
// of bad orders is more than good.
978-
int Cost = 0;
979-
Cost += getInstrOrderCost();
982+
int Cost = getInstrOrderCost();
980983
DEBUG(dbgs() << "Cost = " << Cost << "\n");
981-
if (Cost < 0)
984+
if (Cost < -LoopInterchangeCostThreshold)
982985
return true;
983986

984987
// It is not profitable as per current cache profitability model. But check if

0 commit comments

Comments
 (0)