[flang-commits] [lld] [llvm] [lldb] [clang-tools-extra] [libcxx] [libunwind] [mlir] [libc] [clang] [compiler-rt] [flang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

Mingming Liu via flang-commits flang-commits at lists.llvm.org
Fri Nov 17 13:00:59 PST 2023


================
@@ -453,11 +471,94 @@ Error InstrProfSymtab::create(Module &M, bool InLTO) {
     if (Error E = addFuncWithName(F, getPGOFuncName(F, InLTO)))
       return E;
   }
+
+  SmallVector<MDNode *, 2> Types;
+  for (GlobalVariable &G : M.globals()) {
+    if (!G.hasName())
+      continue;
+    Types.clear();
+    G.getMetadata(LLVMContext::MD_type, Types);
+    if (!Types.empty()) {
+      MD5VTableMap.emplace_back(G.getGUID(), &G);
+    }
+  }
   Sorted = false;
   finalizeSymtab();
   return Error::success();
 }
 
+/// \c NameStrings is a string composed of one of more possibly encoded
+/// sub-strings. The substrings are separated by 0 or more zero bytes. This
+/// method decodes the string and calls `NameCallback` for each substring.
+static Error
+readAndDecodeStrings(StringRef NameStrings,
----------------
minglotus-6 wrote:

Since InstrProfTest.cpp changes a lot, created a [nfc patch](https://github.com/llvm/llvm-project/pull/72611/files) to prepare for test coverage of a new type of value profiles.

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


More information about the flang-commits mailing list