[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)

Mingming Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 25 13:18:14 PST 2024


================
@@ -124,6 +124,28 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser,
         Worklist.push_back(Operand);
     }
   }
+
+  const Instruction *I = dyn_cast<Instruction>(CurUser);
+  if (I) {
+    uint32_t ActualNumValueData = 0;
+    uint64_t TotalCount = 0;
+    // 24 is the maximum number of values preserved for one instrumented site,
+    // defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in
+    // compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as
+    // `MaxNumValueData` controls the max number of elements in the returned
+    // array. The actual number of values is gated by the number of ops in !prof
+    // metadata.
+    auto ValueDataArray = getValueProfDataFromInst(
+        *I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData,
----------------
minglotus-6 wrote:

If the number of vtables is too many compared with the number of functions (i.e., 3 indirect call candidates from 10 vtables), ICP transformation heuristic should choose function comparison based on my experiment). I'll introduce a `cl::opt` option and limits the default value as 6 (2x of [function's default](https://github.com/llvm/llvm-project/blob/e99edf6bcb20169e153110426f840a2dfeeec66d/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp#L180))

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


More information about the llvm-branch-commits mailing list