forked from OSchip/llvm-project
[LoopInterchange] Add CL option to override cost threshold.
Mostly useful for getting consistent lit testing. llvm-svn: 281500
This commit is contained in:
parent
fbbb28ebb3
commit
72431890b1
|
@ -44,6 +44,10 @@ using namespace llvm;
|
||||||
|
|
||||||
#define DEBUG_TYPE "loop-interchange"
|
#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 {
|
namespace {
|
||||||
|
|
||||||
typedef SmallVector<Loop *, 8> LoopVector;
|
typedef SmallVector<Loop *, 8> LoopVector;
|
||||||
|
@ -975,10 +979,9 @@ bool LoopInterchangeProfitability::isProfitable(unsigned InnerLoopId,
|
||||||
// This is rough cost estimation algorithm. It counts the good and bad order
|
// 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 induction variables in the instruction and allows reordering if number
|
||||||
// of bad orders is more than good.
|
// of bad orders is more than good.
|
||||||
int Cost = 0;
|
int Cost = getInstrOrderCost();
|
||||||
Cost += getInstrOrderCost();
|
|
||||||
DEBUG(dbgs() << "Cost = " << Cost << "\n");
|
DEBUG(dbgs() << "Cost = " << Cost << "\n");
|
||||||
if (Cost < 0)
|
if (Cost < -LoopInterchangeCostThreshold)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// It is not profitable as per current cache profitability model. But check if
|
// It is not profitable as per current cache profitability model. But check if
|
||||||
|
|
Loading…
Reference in New Issue