Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IRPGO] [Draft] Import vtable definitions in ThinTLO and use more efficient vtable comparison sequence with cost-benefit analysis #69141

Closed
wants to merge 6 commits into from

Conversation

minglotus-6
Copy link
Contributor

@minglotus-6 minglotus-6 commented Oct 16, 2023

Parent patch is #66825

…used to do virtual table address comparision for indirect-call-promotion.

The changes include:
1) Insert value profile intrinsics and lowering them.
   - Introduced INSTR_PROF_VTABLE_DATA to record per-vtable data.
   - Modified LLVM_PROF_RAW_HEADER to record the metadata for vtable profiles.
   - Test case in llvm/test/Transforms/PGOProfile/vtable_profile.ll
2) Tooling support in llvm-profdata to show the added vtable information
   - Changes are made in {raw,text,indexed} prof reader and/or writer to read/write vtable profile data.
   - Test cases added in llvm/test/tools/llvm-profdata
- In IndirectCallVisitor, instrument vtables and skip the rest (e.g., function pointers, etc).
- Add brief comments for helper functions, remove debugging logs and rename vtable name section to vtabnames.
…ntrol vtable

instrumentation, and record address range of vtables (in
VTableAddRangeToMD5Map).
- The new option is used in PGOInstrumentation.cpp and
  InstrProfiling.cpp to flag-control the instrumentation of static and
  runtime information. Static information includes vtable address range
  and name md5 hash, runtime information are types of a vtable value.
- Before this commit, VTableAddrToMD5Map records start and end of vtable
  address individually. After this commit, the map records a range to
  return MD5 iff the address is within the range. This is more accurate
  when runtime address is collected in one module but static vtable
  information is not recorded.
1. Format the code indentation in IndirectCallVisitor.h, and add a FIXME
   to do more efficient vtable instrumentation.
2. In InstrProfSymtab::finalizeSymtab, sort and uniquify
   VTableAddrRangeToMD5Map (somehow forgot this when preparing this
   patch, the full prototype includes profile-use did this already.)
@minglotus-6
Copy link
Contributor Author

Close this stale patch and won't merge conflicts in this one.

Working on #81442 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant