[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:07:38 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:
This is [defined](https://github.com/llvm/llvm-project/pull/66825/files#diff-da37bd91946b34b8d50ced64d8e9f79455b61e8d29b304d0ae9fe3148bc63333R556-R564) in InstrProf.h in the PR to instrument vtables and [used](https://github.com/llvm/llvm-project/pull/66825/files#diff-da37bd91946b34b8d50ced64d8e9f79455b61e8d29b304d0ae9fe3148bc63333R642-R645) to add vtable strings from raw profiles (`InstrProfSymtab::create` called [here](https://github.com/llvm/llvm-project/pull/66825/files#diff-b196b796c5a396c7cdf93b347fe47e2b29b72d0b7dd0e2b88abb964d376ee50eR544-R545))
The diff is not shown in this PR, but I got a [link](https://github.com/llvm/llvm-project/pull/81051/files#diff-da37bd91946b34b8d50ced64d8e9f79455b61e8d29b304d0ae9fe3148bc63333L579-L587) pointing to it.
https://github.com/llvm/llvm-project/pull/81051
More information about the llvm-branch-commits
mailing list