diff options
author | Cong Hou <congh@google.com> | 2015-12-22 18:56:14 +0000 |
---|---|---|
committer | Cong Hou <congh@google.com> | 2015-12-22 18:56:14 +0000 |
commit | e93b8e1539857d770cdd5a815b4bc3f3eb474e51 (patch) | |
tree | d34ed3f2714f3d216a58a42368b215c08f36631a /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 4e4f60ded087ac264a05dd1738d20cde60932cb2 (diff) | |
download | bcm5719-llvm-e93b8e1539857d770cdd5a815b4bc3f3eb474e51.tar.gz bcm5719-llvm-e93b8e1539857d770cdd5a815b4bc3f3eb474e51.zip |
[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
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index ee1a2045190..db3fef524b3 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -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); } } |