[clang] [compiler-rt] [llvm] [InstrFDO][TypeProf] Implement binary instrumentation and profile read/write (PR #66825)
Mingming Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 5 22:09:29 PST 2024
================
@@ -16,23 +16,72 @@
#include <vector>
namespace llvm {
-// Visitor class that finds all indirect call.
+// Visitor class that finds indirect calls or instructions that gives vtable
+// value, depending on Type.
struct PGOIndirectCallVisitor : public InstVisitor<PGOIndirectCallVisitor> {
+ enum class InstructionType {
+ kIndirectCall = 0,
+ kVTableVal = 1,
+ };
std::vector<CallBase *> IndirectCalls;
- PGOIndirectCallVisitor() = default;
+ std::vector<Instruction *> ProfiledAddresses;
+ PGOIndirectCallVisitor(InstructionType Type) : Type(Type) {}
void visitCallBase(CallBase &Call) {
- if (Call.isIndirectCall())
+ if (Call.isIndirectCall()) {
----------------
minglotus-6 wrote:
done.
I also updated the code such that 'IndirectCalls' is maintained iff 'Type' is 'kIndirectCall' and 'ProfiledAddresses' is maintained iff 'Type' is 'kVTableVal'.
https://github.com/llvm/llvm-project/pull/66825
More information about the cfe-commits
mailing list