[llvm-branch-commits] [llvm][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)

Matthias Braun via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 8 18:28:40 PDT 2024


================
@@ -55,6 +55,20 @@ MDNode *getBranchWeightMDNode(const Instruction &I);
 /// Nullptr otherwise.
 MDNode *getValidBranchWeightMDNode(const Instruction &I);
 
+/// Check if Branch Weight Metadata has an "expected" field from an llvm.expect*
+/// intrinsic
+bool hasExpectedProvenance(const Instruction &I);
+
+/// Check if Branch Weight Metadata has an "expected" field from an llvm.expect*
+/// intrinsic
+bool hasExpectedProvenance(const MDNode *ProfileData);
----------------
MatzeB wrote:

FWIW: I usually prefer references like `const MDNode &ProfileData` to indicate that an argument mustn't be `nullptr`. Though admittedly that remark comes too late given we already have other `const MDNode *` APIs in this header consistency is also worth something... So I guess I'm fine either way...

https://github.com/llvm/llvm-project/pull/86609


More information about the llvm-branch-commits mailing list