[llvm-branch-commits] [llvm] [InstrProf] Add vtables with type metadata into symtab to look it up with GUID (PR #81051)

Mingming Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 13 13:30:45 PST 2024


================
@@ -479,15 +479,37 @@ Error InstrProfSymtab::create(Module &M, bool InLTO) {
       continue;
     Types.clear();
     G.getMetadata(LLVMContext::MD_type, Types);
-    if (!Types.empty()) {
-      MD5VTableMap.emplace_back(G.getGUID(), &G);
-    }
+    if (Types.empty())
+      continue;
+    if (Error E = addVTableWithName(
+              G, getIRPGOObjectName(G, InLTO, /* PGONameMetadata */ nullptr)))
+        return E;
   }
   Sorted = false;
   finalizeSymtab();
   return Error::success();
 }
 
+Error InstrProfSymtab::addVTableWithName(GlobalVariable &VTable,
+                                         StringRef VTablePGOName) {
+                                          
+  auto mapName = [&](StringRef Name) -> Error {
+    if (Error E = addVTableName(Name))
----------------
minglotus-6 wrote:

And in the latest [commit](https://github.com/llvm/llvm-project/pull/81051/commits/003319d8d1f791dbe0c34bf82f0043f71b330d68) I decided to call `addSymbolName` and added some comments around. It's a change in the diffbase to make `addFuncName` a [wrapper](https://github.com/llvm/llvm-project/pull/66825/files#diff-da37bd91946b34b8d50ced64d8e9f79455b61e8d29b304d0ae9fe3148bc63333R552) around [`addSymbolName`](https://github.com/llvm/llvm-project/pull/66825/files#diff-da37bd91946b34b8d50ced64d8e9f79455b61e8d29b304d0ae9fe3148bc63333R534).

Meanwhile as the functions from the diffbase (mainly `InstrProf.h/cpp`) starts to be used in subsequent patches, I'll start to get the first instrumentation patch (https://github.com/llvm/llvm-project/pull/66825) into main branch. 


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


More information about the llvm-branch-commits mailing list