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

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 6 11:07:17 PDT 2024


================
@@ -55,6 +55,17 @@ 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 hasBranchWeightProvenance(const Instruction &I);
----------------
ilovepi wrote:

hmm, I see your point, given its current use, but I do think we'll want to track more things in the future. Some other options: `IsBranchWeightFromLlvmIntrinsic`,  `hasOptionalMetadataField`, or `hasBranchWeightOrigin`? The last is basically the same as the current, but avoids the use of `Provenance` like @MatzeB brought up earlier. 

WDYT?

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


More information about the llvm-branch-commits mailing list