diff options
author | Paul Kirth <paulkirth@google.com> | 2022-07-27 21:38:11 +0000 |
---|---|---|
committer | Paul Kirth <paulkirth@google.com> | 2022-07-27 21:38:11 +0000 |
commit | 6e9bab71b626183211625f150cc25fa22cb0973c (patch) | |
tree | 0980e161128b3a6244ef0172d76f70fb38bcc1e5 /llvm/lib/CodeGen/SelectOptimize.cpp | |
parent | 300c9a78819b4608b96bb26f9320bea6b8a0c4d0 (diff) | |
download | llvm-6e9bab71b626183211625f150cc25fa22cb0973c.zip llvm-6e9bab71b626183211625f150cc25fa22cb0973c.tar.gz llvm-6e9bab71b626183211625f150cc25fa22cb0973c.tar.bz2 |
Revert "[llvm][NFC] Refactor code to use ProfDataUtils"
This reverts commit 300c9a78819b4608b96bb26f9320bea6b8a0c4d0.
We will reland once these issues are ironed out.
Diffstat (limited to 'llvm/lib/CodeGen/SelectOptimize.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectOptimize.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index a7a6987..011f55e 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -29,7 +29,6 @@ #include "llvm/IR/Function.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Instruction.h" -#include "llvm/IR/ProfDataUtils.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/ScaledNumber.h" @@ -656,7 +655,7 @@ bool SelectOptimize::hasExpensiveColdOperand( const SmallVector<SelectInst *, 2> &ASI) { bool ColdOperand = false; uint64_t TrueWeight, FalseWeight, TotalWeight; - if (extractBranchWeights(*ASI.front(), TrueWeight, FalseWeight)) { + if (ASI.front()->extractProfMetadata(TrueWeight, FalseWeight)) { uint64_t MinWeight = std::min(TrueWeight, FalseWeight); TotalWeight = TrueWeight + FalseWeight; // Is there a path with frequency <ColdOperandThreshold% (default:20%) ? @@ -751,7 +750,7 @@ void SelectOptimize::getExclBackwardsSlice(Instruction *I, bool SelectOptimize::isSelectHighlyPredictable(const SelectInst *SI) { uint64_t TrueWeight, FalseWeight; - if (extractBranchWeights(*SI, TrueWeight, FalseWeight)) { + if (SI->extractProfMetadata(TrueWeight, FalseWeight)) { uint64_t Max = std::max(TrueWeight, FalseWeight); uint64_t Sum = TrueWeight + FalseWeight; if (Sum != 0) { @@ -960,7 +959,7 @@ SelectOptimize::getPredictedPathCost(Scaled64 TrueCost, Scaled64 FalseCost, const SelectInst *SI) { Scaled64 PredPathCost; uint64_t TrueWeight, FalseWeight; - if (extractBranchWeights(*SI, TrueWeight, FalseWeight)) { + if (SI->extractProfMetadata(TrueWeight, FalseWeight)) { uint64_t SumWeight = TrueWeight + FalseWeight; if (SumWeight != 0) { PredPathCost = TrueCost * Scaled64::get(TrueWeight) + |