[llvm] [ProfileData] Add a variant of getValueProfDataFromInst (PR #95993)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 22:34:30 PDT 2024


================
@@ -294,6 +294,13 @@ getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
                          uint32_t MaxNumValueData, uint32_t &ActualNumValueData,
                          uint64_t &TotalC, bool GetNoICPValue = false);
 
+/// Extract the value profile data from \p Inst and returns them if \p Inst is
+/// annotated with value profile data. Returns an empty vector otherwise.
+std::vector<InstrProfValueData>
----------------
minglotus-6 wrote:

> Three inline elements would cover 84% of the cases.
> Four inline elements would cover 100% of the cases. Three inline elements would cover 84% of the cases.

Choosing 4 lgtm.

The observation should be related with https://github.com/llvm/llvm-project/blob/3c8f3b91d898cb3f76e1e430da98972cdf8a4a1c/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp#L1764-L1767.  `MaxNumMemOPAnnotations` is 4 by default and `MaxNumAnnotations` is 3.

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


More information about the llvm-commits mailing list