[llvm] [TypeProf][PGO]Skip vtable-based ICP for which type profiles are known to be unrepresentative (PR #110575)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 08:50:35 PDT 2024
================
@@ -851,8 +859,27 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
LLVM_DEBUG(dbgs() << "\n");
uint64_t CandidateVTableCount = 0;
- for (auto &[GUID, Count] : VTableGUIDAndCounts)
+ SmallVector<MDNode *, 2> Types;
+ for (auto &[GUID, Count] : VTableGUIDAndCounts) {
CandidateVTableCount += Count;
+ auto *VTableVar = Symtab->getGlobalVariable(GUID);
+
+ assert(VTableVar &&
+ "VTableVar must exist for GUID in VTableGUIDAndCounts");
+
+ Types.clear();
+ VTableVar->getMetadata(LLVMContext::MD_type, Types);
+
+ const DenseSet<StringRef> &VTableSet = ICPIgnoredBaseTypes.getValue();
+ for (auto *Type : Types)
+ if (auto *TypeId = dyn_cast<MDString>(Type->getOperand(1).get()))
+ if (VTableSet.contains(TypeId->getString().str())) {
+ LLVM_DEBUG(dbgs()
+ << " vtable profiles are known to be "
----------------
snehasish wrote:
Update the comment? s/known to be unrepresentative/ignored by option ..../
https://github.com/llvm/llvm-project/pull/110575
More information about the llvm-commits
mailing list