Go to the source code of this file.
|
| STATISTIC (NumSelectOptAnalyzed, "Number of select groups considered for conversion to branch") |
|
| STATISTIC (NumSelectConvertedExpColdOperand, "Number of select groups converted due to expensive cold operand") |
|
| STATISTIC (NumSelectConvertedHighPred, "Number of select groups converted due to high-predictability") |
|
| STATISTIC (NumSelectUnPred, "Number of select groups not converted due to unpredictability") |
|
| STATISTIC (NumSelectColdBB, "Number of select groups not converted due to cold basic block") |
|
| STATISTIC (NumSelectConvertedLoop, "Number of select groups converted due to loop-level analysis") |
|
| STATISTIC (NumSelectsConverted, "Number of selects converted") |
|
| INITIALIZE_PASS_BEGIN (SelectOptimize, DEBUG_TYPE, "Optimize selects", false, false) INITIALIZE_PASS_END(SelectOptimize |
|
static Value * | getTrueOrFalseValue (SelectOptimizeImpl::SelectLike SI, bool isTrue, const SmallPtrSet< const Instruction *, 2 > &Selects, IRBuilder<> &IB) |
| If isTrue is true, return the true value of SI , otherwise return false value of SI .
|
|
static void | EmitAndPrintRemark (OptimizationRemarkEmitter *ORE, DiagnosticInfoOptimizationBase &Rem) |
|
static InstructionCost | divideNearest (InstructionCost Numerator, uint64_t Denominator) |
|
static bool | extractBranchWeights (const SelectOptimizeImpl::SelectLike SI, uint64_t &TrueVal, uint64_t &FalseVal) |
|
static bool | isSafeToSinkLoad (Instruction *LoadI, Instruction *SI) |
|
|
static cl::opt< unsigned > | ColdOperandThreshold ("cold-operand-threshold", cl::desc("Maximum frequency of path for an operand to be considered cold."), cl::init(20), cl::Hidden) |
|
static cl::opt< unsigned > | ColdOperandMaxCostMultiplier ("cold-operand-max-cost-multiplier", cl::desc("Maximum cost multiplier of TCC_expensive for the dependence " "slice of a cold operand to be considered inexpensive."), cl::init(1), cl::Hidden) |
|
static cl::opt< unsigned > | GainGradientThreshold ("select-opti-loop-gradient-gain-threshold", cl::desc("Gradient gain threshold (%)."), cl::init(25), cl::Hidden) |
|
static cl::opt< unsigned > | GainCycleThreshold ("select-opti-loop-cycle-gain-threshold", cl::desc("Minimum gain per loop (in cycles) threshold."), cl::init(4), cl::Hidden) |
|
static cl::opt< unsigned > | GainRelativeThreshold ("select-opti-loop-relative-gain-threshold", cl::desc("Minimum relative gain per loop threshold (1/X). Defaults to 12.5%"), cl::init(8), cl::Hidden) |
|
static cl::opt< unsigned > | MispredictDefaultRate ("mispredict-default-rate", cl::Hidden, cl::init(25), cl::desc("Default mispredict rate (initialized to 25%).")) |
|
static cl::opt< bool > | DisableLoopLevelHeuristics ("disable-loop-level-heuristics", cl::Hidden, cl::init(false), cl::desc("Disable loop-level heuristics.")) |
|
| DEBUG_TYPE |
|
Optimize | selects |
|
Optimize | false |
|
◆ DEBUG_TYPE
#define DEBUG_TYPE "select-optimize" |
◆ divideNearest()
◆ EmitAndPrintRemark()
◆ extractBranchWeights()
◆ getTrueOrFalseValue()
If isTrue
is true, return the true value of SI
, otherwise return false value of SI
.
If the true/false value of SI
is defined by any select instructions in Selects
, look through the defining select instruction until the true/false value is not defined in Selects
.
Definition at line 533 of file SelectOptimize.cpp.
References assert(), and llvm::SmallPtrSetImpl< PtrType >::count().
◆ INITIALIZE_PASS_BEGIN()
INITIALIZE_PASS_BEGIN |
( |
SelectOptimize |
, |
|
|
DEBUG_TYPE |
, |
|
|
"Optimize selects" |
, |
|
|
false |
, |
|
|
false |
|
|
) |
| |
◆ isSafeToSinkLoad()
◆ STATISTIC() [1/7]
STATISTIC |
( |
NumSelectColdBB |
, |
|
|
"Number of select groups not converted due to cold basic block" |
|
|
) |
| |
◆ STATISTIC() [2/7]
STATISTIC |
( |
NumSelectConvertedExpColdOperand |
, |
|
|
"Number of select groups converted due to expensive cold operand" |
|
|
) |
| |
◆ STATISTIC() [3/7]
STATISTIC |
( |
NumSelectConvertedHighPred |
, |
|
|
"Number of select groups converted due to high-predictability" |
|
|
) |
| |
◆ STATISTIC() [4/7]
STATISTIC |
( |
NumSelectConvertedLoop |
, |
|
|
"Number of select groups converted due to loop-level analysis" |
|
|
) |
| |
◆ STATISTIC() [5/7]
STATISTIC |
( |
NumSelectOptAnalyzed |
, |
|
|
"Number of select groups considered for conversion to branch" |
|
|
) |
| |
◆ STATISTIC() [6/7]
STATISTIC |
( |
NumSelectsConverted |
, |
|
|
"Number of selects converted" |
|
|
) |
| |
◆ STATISTIC() [7/7]
STATISTIC |
( |
NumSelectUnPred |
, |
|
|
"Number of select groups not converted due to unpredictability" |
|
|
) |
| |
◆ ColdOperandMaxCostMultiplier
cl::opt< unsigned > ColdOperandMaxCostMultiplier("cold-operand-max-cost-multiplier", cl::desc("Maximum cost multiplier of TCC_expensive for the dependence " "slice of a cold operand to be considered inexpensive."), cl::init(1), cl::Hidden) |
( |
"cold-operand-max-cost-multiplier" |
, |
|
|
cl::desc("Maximum cost multiplier of TCC_expensive for the dependence " "slice of a cold operand to be considered inexpensive.") |
, |
|
|
cl::init(1) |
, |
|
|
cl::Hidden |
|
|
) |
| |
|
static |
◆ ColdOperandThreshold
cl::opt< unsigned > ColdOperandThreshold("cold-operand-threshold", cl::desc("Maximum frequency of path for an operand to be considered cold."), cl::init(20), cl::Hidden) |
( |
"cold-operand-threshold" |
, |
|
|
cl::desc("Maximum frequency of path for an operand to be considered cold.") |
, |
|
|
cl::init(20) |
, |
|
|
cl::Hidden |
|
|
) |
| |
|
static |
◆ DEBUG_TYPE
◆ DisableLoopLevelHeuristics
cl::opt< bool > DisableLoopLevelHeuristics("disable-loop-level-heuristics", cl::Hidden, cl::init(false), cl::desc("Disable loop-level heuristics.")) |
( |
"disable-loop-level-heuristics" |
, |
|
|
cl::Hidden |
, |
|
|
cl::init(false) |
, |
|
|
cl::desc("Disable loop-level heuristics.") |
|
|
) |
| |
|
static |
◆ false
◆ GainCycleThreshold
cl::opt< unsigned > GainCycleThreshold("select-opti-loop-cycle-gain-threshold", cl::desc("Minimum gain per loop (in cycles) threshold."), cl::init(4), cl::Hidden) |
( |
"select-opti-loop-cycle-gain-threshold" |
, |
|
|
cl::desc("Minimum gain per loop (in cycles) threshold.") |
, |
|
|
cl::init(4) |
, |
|
|
cl::Hidden |
|
|
) |
| |
|
static |
◆ GainGradientThreshold
cl::opt< unsigned > GainGradientThreshold("select-opti-loop-gradient-gain-threshold", cl::desc("Gradient gain threshold (%)."), cl::init(25), cl::Hidden) |
( |
"select-opti-loop-gradient-gain-threshold" |
, |
|
|
cl::desc("Gradient gain threshold (%).") |
, |
|
|
cl::init(25) |
, |
|
|
cl::Hidden |
|
|
) |
| |
|
static |
◆ GainRelativeThreshold
cl::opt< unsigned > GainRelativeThreshold("select-opti-loop-relative-gain-threshold", cl::desc( "Minimum relative gain per loop threshold (1/X). Defaults to 12.5%"), cl::init(8), cl::Hidden) |
( |
"select-opti-loop-relative-gain-threshold" |
, |
|
|
cl::desc( "Minimum relative gain per loop threshold (1/X). Defaults to 12.5%") |
, |
|
|
cl::init(8) |
, |
|
|
cl::Hidden |
|
|
) |
| |
|
static |
◆ MispredictDefaultRate
cl::opt< unsigned > MispredictDefaultRate("mispredict-default-rate", cl::Hidden, cl::init(25), cl::desc("Default mispredict rate (initialized to 25%).")) |
( |
"mispredict-default-rate" |
, |
|
|
cl::Hidden |
, |
|
|
cl::init(25) |
, |
|
|
cl::desc("Default mispredict rate (initialized to 25%).") |
|
|
) |
| |
|
static |
◆ selects