[all-commits] [llvm/llvm-project] ff3c21: [TypeProf][InstrFDO]Implement more efficient compa...
Mingming Liu via All-commits
all-commits at lists.llvm.org
Tue May 28 08:53:02 PDT 2024
Branch: refs/heads/users/minglotus-6/spr/icpass
Home: https://github.com/llvm/llvm-project
Commit: ff3c219db4d9d925af282e9f579fb9bd55985508
https://github.com/llvm/llvm-project/commit/ff3c219db4d9d925af282e9f579fb9bd55985508
Author: mingmingl <mingmingl at google.com>
Date: 2024-05-28 (Tue, 28 May 2024)
Changed paths:
M compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp
M llvm/include/llvm/Analysis/IndirectCallVisitor.h
M llvm/include/llvm/Transforms/Utils/Local.h
M llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
M llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
M llvm/lib/Transforms/Utils/InlineFunction.cpp
M llvm/lib/Transforms/Utils/Local.cpp
M llvm/test/Transforms/Inline/update_invoke_prof.ll
M llvm/test/Transforms/Inline/update_value_profile.ll
M llvm/test/Transforms/PGOProfile/icp_vtable_cmp.ll
M llvm/test/Transforms/PGOProfile/icp_vtable_invoke.ll
M llvm/test/Transforms/PGOProfile/icp_vtable_tail_call.ll
Log Message:
-----------
[TypeProf][InstrFDO]Implement more efficient comparison sequence for
indirect-call-promotion with vtable profiles.
Clang's `-fwhole-program-vtables` is required for this optimization to
take place. If `-fwhole-program-vtables` is not enabled, this change is
no-op.
Function-comparison (before):
VTable-comparison (after):
Key changes:
1. Find out virtual calls and the vtables they come from.
- The ICP relies on type intrinsic `llvm.type.test` and
`llvm.public.type.test` to find out virtual calls and the
compatible vtables, and relies on type metadata to find the address
point (offset) for comparison.
2. ICP pass does cost-benefit analysis and compares vtable only when
both conditions are met
1) The function addressing and vtable load can sink to indirect
fallback, and the indirect fallback is cold block
2) The number of vtables for a function candidate is within
(option specified) threshold.
3. Sink the function addressing and vtable load instruction to indirect
fallback.
- The sink helper functions are simplified versions of
`InstCombinerImpl::tryToSinkInstruction`.
- The helper functions to handle debug intrinsics are copied from
`InstCombinerImpl::tryToSinkInstructionDbgValues` and
`InstCombinerImpl::tryToSinkInstructionDbgVariableRecords` into
Transforms/Utils/Local.cpp. Ideally only one copy should exist
for inst-combine, icp and other passes.
4. Keep value profiles updated
1) Update vtable value profiles after inline
2) For either function-based comparison or vtable-based comparison,
update both vtable and indirect call value profiles.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list