mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Replace hard coded probability threshold with parameter /NFC
llvm-svn: 271751
This commit is contained in:
parent
56ea31445a
commit
c1bc30f856
@ -116,6 +116,8 @@ static cl::opt<unsigned> JumpInstCost("jump-inst-cost",
|
||||
cl::desc("Cost of jump instructions."),
|
||||
cl::init(1), cl::Hidden);
|
||||
|
||||
extern cl::opt<unsigned> StaticLikelyProb;
|
||||
|
||||
namespace {
|
||||
class BlockChain;
|
||||
/// \brief Type for our function-wide basic block -> block chain mapping.
|
||||
@ -405,7 +407,7 @@ MachineBasicBlock *
|
||||
MachineBlockPlacement::selectBestSuccessor(MachineBasicBlock *BB,
|
||||
BlockChain &Chain,
|
||||
const BlockFilterSet *BlockFilter) {
|
||||
const BranchProbability HotProb(4, 5); // 80%
|
||||
const BranchProbability HotProb(StaticLikelyProb, 100);
|
||||
|
||||
MachineBasicBlock *BestSucc = nullptr;
|
||||
auto BestProb = BranchProbability::getZero();
|
||||
|
@ -24,9 +24,14 @@ INITIALIZE_PASS_BEGIN(MachineBranchProbabilityInfo, "machine-branch-prob",
|
||||
INITIALIZE_PASS_END(MachineBranchProbabilityInfo, "machine-branch-prob",
|
||||
"Machine Branch Probability Analysis", false, true)
|
||||
|
||||
cl::opt<unsigned> StaticLikelyProb(
|
||||
"static-likely-prob",
|
||||
cl::desc("branch probability threshold to be considered very likely"),
|
||||
cl::init(80), cl::Hidden);
|
||||
|
||||
char MachineBranchProbabilityInfo::ID = 0;
|
||||
|
||||
void MachineBranchProbabilityInfo::anchor() { }
|
||||
void MachineBranchProbabilityInfo::anchor() {}
|
||||
|
||||
BranchProbability MachineBranchProbabilityInfo::getEdgeProbability(
|
||||
const MachineBasicBlock *Src,
|
||||
@ -42,11 +47,9 @@ BranchProbability MachineBranchProbabilityInfo::getEdgeProbability(
|
||||
std::find(Src->succ_begin(), Src->succ_end(), Dst));
|
||||
}
|
||||
|
||||
bool
|
||||
MachineBranchProbabilityInfo::isEdgeHot(const MachineBasicBlock *Src,
|
||||
const MachineBasicBlock *Dst) const {
|
||||
// Hot probability is at least 4/5 = 80%
|
||||
static BranchProbability HotProb(4, 5);
|
||||
bool MachineBranchProbabilityInfo::isEdgeHot(
|
||||
const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const {
|
||||
BranchProbability HotProb(StaticLikelyProb, 100);
|
||||
return getEdgeProbability(Src, Dst) > HotProb;
|
||||
}
|
||||
|
||||
@ -63,7 +66,7 @@ MachineBranchProbabilityInfo::getHotSucc(MachineBasicBlock *MBB) const {
|
||||
}
|
||||
}
|
||||
|
||||
static BranchProbability HotProb(4, 5);
|
||||
BranchProbability HotProb(StaticLikelyProb, 100);
|
||||
if (getEdgeProbability(MBB, MaxSucc) >= HotProb)
|
||||
return MaxSucc;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user