diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2019-09-11 09:16:17 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2019-09-11 09:16:17 +0000 |
commit | 57256af307ab7bdf42c47da019a1a288b9f9451a (patch) | |
tree | 27b79009fe825ffd54dd574662213f2d659f35fd /llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp | |
parent | 73ec745793acdddc505610ae6a1087ada3140ef2 (diff) | |
download | bcm5719-llvm-57256af307ab7bdf42c47da019a1a288b9f9451a.tar.gz bcm5719-llvm-57256af307ab7bdf42c47da019a1a288b9f9451a.zip |
Revert "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"
This reverts commit r371584. It introduced a dependency from compiler-rt
to llvm/include/ADT, which is problematic for multiple reasons.
One is that it is a novel dependency edge, which needs cross-compliation
machinery for llvm/include/ADT (yes, it is true that right now
compiler-rt included only header-only libraries, however, if we allow
compiler-rt to depend on anything from ADT, other libraries will
eventually get used).
Secondly, depending on ADT from compiler-rt exposes ADT symbols from
compiler-rt, which would cause ODR violations when Clang is built with
the profile library.
llvm-svn: 371598
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp b/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp index cdb1d790667..0d67c0d740e 100644 --- a/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp +++ b/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp @@ -26,7 +26,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/Utils/MisExpect.h" using namespace llvm; @@ -72,20 +71,15 @@ static bool handleSwitchExpect(SwitchInst &SI) { unsigned n = SI.getNumCases(); // +1 for default case. SmallVector<uint32_t, 16> Weights(n + 1, UnlikelyBranchWeight); - uint64_t Index = (Case == *SI.case_default()) ? 0 : Case.getCaseIndex() + 1; - Weights[Index] = LikelyBranchWeight; - - SI.setMetadata( - LLVMContext::MD_misexpect, - MDBuilder(CI->getContext()) - .createMisExpect(Index, LikelyBranchWeight, UnlikelyBranchWeight)); - - SI.setCondition(ArgValue); - misexpect::checkFrontendInstrumentation(SI); + if (Case == *SI.case_default()) + Weights[0] = LikelyBranchWeight; + else + Weights[Case.getCaseIndex() + 1] = LikelyBranchWeight; SI.setMetadata(LLVMContext::MD_prof, MDBuilder(CI->getContext()).createBranchWeights(Weights)); + SI.setCondition(ArgValue); return true; } @@ -286,28 +280,19 @@ template <class BrSelInst> static bool handleBrSelExpect(BrSelInst &BSI) { MDBuilder MDB(CI->getContext()); MDNode *Node; - MDNode *ExpNode; if ((ExpectedValue->getZExtValue() == ValueComparedTo) == - (Predicate == CmpInst::ICMP_EQ)) { + (Predicate == CmpInst::ICMP_EQ)) Node = MDB.createBranchWeights(LikelyBranchWeight, UnlikelyBranchWeight); - ExpNode = MDB.createMisExpect(0, LikelyBranchWeight, UnlikelyBranchWeight); - } else { + else Node = MDB.createBranchWeights(UnlikelyBranchWeight, LikelyBranchWeight); - ExpNode = MDB.createMisExpect(1, LikelyBranchWeight, UnlikelyBranchWeight); - } - BSI.setMetadata(LLVMContext::MD_misexpect, ExpNode); + BSI.setMetadata(LLVMContext::MD_prof, Node); if (CmpI) CmpI->setOperand(0, ArgValue); else BSI.setCondition(ArgValue); - - misexpect::checkFrontendInstrumentation(BSI); - - BSI.setMetadata(LLVMContext::MD_prof, Node); - return true; } |