[llvm] [ProfCheck] Add utility to get a MDNode for unknown branch weights (PR #180389)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 7 22:37:48 PST 2026
================
@@ -289,6 +289,18 @@ void llvm::setExplicitlyUnknownBranchWeightsIfProfiled(Instruction &I,
setExplicitlyUnknownBranchWeights(I, PassName);
}
+MDNode *llvm::getExplicitlyUnknownBranchWeightsIfProfiled(Function &F,
+ StringRef PassName) {
+ if (std::optional<Function::ProfileCount> EC = F.getEntryCount();
+ !EC || EC->getCount() == 0)
----------------
snehasish wrote:
I don't think it matters much in practice. The inconsistency with the function name bothers me since it implies unprofiled if unknown.
https://github.com/llvm/llvm-project/pull/180389
More information about the llvm-commits
mailing list