[BPI] Replace weights by probabilities in BPI.
This patch removes all weight-related interfaces from BPI and replace them by probability versions. With this patch, we won't use edge weight anymore in either IR or MC passes. Edge probabilitiy is a better representation in terms of CFG update and validation. Differential revision: http://reviews.llvm.org/D15519 llvm-svn: 256263
This commit is contained in:
@@ -453,12 +453,13 @@ bool StackProtector::InsertStackProtectors() {
|
||||
LoadInst *LI1 = B.CreateLoad(StackGuardVar);
|
||||
LoadInst *LI2 = B.CreateLoad(AI);
|
||||
Value *Cmp = B.CreateICmpEQ(LI1, LI2);
|
||||
unsigned SuccessWeight =
|
||||
BranchProbabilityInfo::getBranchWeightStackProtector(true);
|
||||
unsigned FailureWeight =
|
||||
BranchProbabilityInfo::getBranchWeightStackProtector(false);
|
||||
auto SuccessProb =
|
||||
BranchProbabilityInfo::getBranchProbStackProtector(true);
|
||||
auto FailureProb =
|
||||
BranchProbabilityInfo::getBranchProbStackProtector(false);
|
||||
MDNode *Weights = MDBuilder(F->getContext())
|
||||
.createBranchWeights(SuccessWeight, FailureWeight);
|
||||
.createBranchWeights(SuccessProb.getNumerator(),
|
||||
FailureProb.getNumerator());
|
||||
B.CreateCondBr(Cmp, NewBB, FailBB, Weights);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user