[compiler-rt] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)
David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 15:51:16 PDT 2023
================
@@ -90,9 +90,33 @@ public:
}
};
+///------------------------ VirtualTableValueProfilingPlugin ------------------------
+class VTableProfilingPlugin {
+ Function &F;
+
+public:
+ static constexpr InstrProfValueKind Kind = IPVK_VTableTarget;
+
+ VTableProfilingPlugin(Function &Fn, TargetLibraryInfo &TLI) : F(Fn) {}
----------------
david-xl wrote:
The candidate selection can be more restrictive to make the vtable value profiling more runtime efficient (value profiling is expensive).
for the following example where ptr points to a polymorphic type,
for ( i = 0 ; i < 1000;i++) {
ptr->func1();
ptr->func2();
ptr->func3();
}
instead of doing value profiling at each each callsite (expensive), do the following:
__instrument_value_profile(site_id, ptr->vfptr);
for (....) {
ptr->func1();
...
}
https://github.com/llvm/llvm-project/pull/66825
More information about the llvm-commits
mailing list