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

Teresa Johnson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 25 14:20:10 PST 2024


================
@@ -124,6 +126,24 @@ 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;
+    // MaxNumVTableAnnotations is the maximum number of vtables annotated on
+    // the instruction.
+    auto ValueDataArray = getValueProfDataFromInst(
+        *I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */,
+        ActualNumValueData, TotalCount);
+
+    if (ValueDataArray.get()) {
+      for (uint32_t j = 0; j < ActualNumValueData; j++) {
+        RefEdges.insert(Index.getOrInsertValueInfo(
+            ValueDataArray[j].Value /* VTableGUID */));
----------------
teresajohnson wrote:

Use format "/* VTableGUID = */ ValueDataArray[j].Value" for consistency with other code.

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


More information about the llvm-branch-commits mailing list