diff options
author | Paul Kirth <paulkirth@google.com> | 2022-07-27 21:44:24 +0000 |
---|---|---|
committer | Paul Kirth <paulkirth@google.com> | 2022-08-03 00:09:45 +0000 |
commit | d434e40f398e3144c69d57d2a142d35e2f760a8e (patch) | |
tree | 00c21846399cb3514183698bee5e2e77c3a2acf7 /llvm/lib/Transforms/Utils/LoopPeel.cpp | |
parent | 6ac30fa6e94118613fd27f0fd896a86852eeea7a (diff) | |
download | llvm-d434e40f398e3144c69d57d2a142d35e2f760a8e.zip llvm-d434e40f398e3144c69d57d2a142d35e2f760a8e.tar.gz llvm-d434e40f398e3144c69d57d2a142d35e2f760a8e.tar.bz2 |
[llvm][NFC] Refactor code to use ProfDataUtils
In this patch we replace common code patterns with the use of utility
functions for dealing with profiling metadata. There should be no change
in functionality, as the existing checks should be preserved in all
cases.
Reviewed By: bogner, davidxl
Differential Revision: https://reviews.llvm.org/D128860
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopPeel.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopPeel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp index f093fea..9a7f9df 100644 --- a/llvm/lib/Transforms/Utils/LoopPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp @@ -29,6 +29,7 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/MDBuilder.h" #include "llvm/IR/PatternMatch.h" +#include "llvm/IR/ProfDataUtils.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" @@ -532,7 +533,7 @@ static void initBranchWeights(BasicBlock *Header, BranchInst *LatchBR, uint64_t &ExitWeight, uint64_t &FallThroughWeight) { uint64_t TrueWeight, FalseWeight; - if (!LatchBR->extractProfMetadata(TrueWeight, FalseWeight)) + if (!extractBranchWeights(*LatchBR, TrueWeight, FalseWeight)) return; unsigned HeaderIdx = LatchBR->getSuccessor(0) == Header ? 0 : 1; ExitWeight = HeaderIdx ? TrueWeight : FalseWeight; |