[llvm] db210c5 - [NFC] Prefer compile-time branching in function template (#203698)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 13 23:34:31 PDT 2026
Author: Shanzhi Chen
Date: 2026-06-14T14:34:26+08:00
New Revision: db210c5e33643a8154329a607b5b6dcd419271df
URL: https://github.com/llvm/llvm-project/commit/db210c5e33643a8154329a607b5b6dcd419271df
DIFF: https://github.com/llvm/llvm-project/commit/db210c5e33643a8154329a607b5b6dcd419271df.diff
LOG: [NFC] Prefer compile-time branching in function template (#203698)
Added:
Modified:
llvm/include/llvm/Analysis/ProfileSummaryInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ProfileSummaryInfo.h b/llvm/include/llvm/Analysis/ProfileSummaryInfo.h
index 02c412729081a..96af93dfc9cf4 100644
--- a/llvm/include/llvm/Analysis/ProfileSummaryInfo.h
+++ b/llvm/include/llvm/Analysis/ProfileSummaryInfo.h
@@ -309,7 +309,7 @@ class ProfileSummaryInfo {
bool isHotOrColdBlockNthPercentile(int PercentileCutoff, const BBType *BB,
BFIT *BFI) const {
auto Count = BFI->getBlockProfileCount(BB);
- if (isHot)
+ if constexpr (isHot)
return Count && isHotCountNthPercentile(PercentileCutoff, *Count);
else
return Count && isColdCountNthPercentile(PercentileCutoff, *Count);
@@ -320,7 +320,7 @@ class ProfileSummaryInfo {
BlockFrequency BlockFreq,
BFIT *BFI) const {
auto Count = BFI->getProfileCountFromFreq(BlockFreq);
- if (isHot)
+ if constexpr (isHot)
return Count && isHotCountNthPercentile(PercentileCutoff, *Count);
else
return Count && isColdCountNthPercentile(PercentileCutoff, *Count);
More information about the llvm-commits
mailing list