aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopPeel.cpp
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2022-06-29 21:31:17 +0000
committerPaul Kirth <paulkirth@google.com>2022-07-27 21:13:54 +0000
commit300c9a78819b4608b96bb26f9320bea6b8a0c4d0 (patch)
tree2beb7b299bfce398ecf2e6ca70fe6c8889e4d64f /llvm/lib/Transforms/Utils/LoopPeel.cpp
parent6047deb7c2aa94d9bc2b70b49799d22cce778bd4 (diff)
downloadllvm-300c9a78819b4608b96bb26f9320bea6b8a0c4d0.zip
llvm-300c9a78819b4608b96bb26f9320bea6b8a0c4d0.tar.gz
llvm-300c9a78819b4608b96bb26f9320bea6b8a0c4d0.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.cpp3
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;