[llvm] [TypeProf][PGO]Support skipping vtable comparisons for a class and its derived ones (PR #110575)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 22:26:09 PDT 2024


================
@@ -851,8 +863,25 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
     LLVM_DEBUG(dbgs() << "\n");
 
     uint64_t CandidateVTableCount = 0;
-    for (auto &[GUID, Count] : VTableGUIDAndCounts)
+
+    for (auto &[GUID, Count] : VTableGUIDAndCounts) {
       CandidateVTableCount += Count;
+      auto *VTableVar = Symtab->getGlobalVariable(GUID);
----------------
minglotus-6 wrote:

This makes sense.

I took the liberty to use a helper function for the new handling, to simplify the control flow (e.g., continue, inner-for-loop and return) inside the outer loop.

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


More information about the llvm-commits mailing list