================
@@ -48,6 +48,13 @@ bool hasValidBranchWeightMD(const Instruction &I);
 /// Nullptr otherwise.
 MDNode *getBranchWeightMDNode(const Instruction &I);
 
+/// Get the branching metadata information
+///
+/// \param I The Instruction to get the weights from.
+/// \returns A pointer to I's branch weights metadata node, if it exists.
+/// Nullptr otherwise.
+MDNode *getDxBranchHint(const Instruction &I);
----------------
ilovepi wrote:

The description seems to conflict with what the implementation does. It doesn't 
return the branch weights at all, it returns a `MD_dxil_controlflow_hints` node.

That aside, I don't think this logic belongs in ProfDataUtils. You're not 
changing or accessing profile data, you're interacting with a new metadata 
type. If there is going to be a generic IR construct for control flow hints, 
and they're going to be part of MD_prof, then I'd feel differently. 

ProfDataUtils was initially created to consolidate how we manipulate MD_prof 
metadata, and prevent (to a certain extent) people from accessing/manipulating 
that metadata in inconsistent ways. It also allows us to support optional 
metadata in the MD_prof node (e.g. 
https://llvm.org/docs/BranchWeightMetadata.html#branchinst), for things like 
MisExpect. That all could be documented better though.

https://github.com/llvm/llvm-project/pull/116331
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to