[PATCH] D83024: [PGO] Instrument function entry BB by default in IR PGO

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 23:57:27 PDT 2020


xur created this revision.
xur added reviewers: davidxl, wmi.
Herald added subscribers: jfb, dexonsmith, steven_wu, hiraditya.
Herald added a project: LLVM.

This patch enables the instrumentation function entry BB by default in
 IR PGO. This will slow down the instrumentation for some cases.
One can use the internal option "-mllvm -pgo-instrument-entry=false"
to disable it.

For single threaded programs, the slowdown should be very minimum.

The benefit of always instrumenting function entry BB is that we
can know the function entry count by form the profile and this often
facilitates some profile offline processing.

This patch also bumps up the index profile version, from 6 to 7.
Strictly speaking, this is not needed -- the instrumentation order depends
on the implementation and there is no guarantee of the instrumentation order.
We bump this up just to prevent some potential breakages (performance wise)
for people using some stored (old) profiles.

This patch will not change the behavior if the profile version is lower
than the new version (7) -- unless the internal option is explicitly specified.

For the index profile with version 7 or above, This patch assumes that the
function entry BB by default. Again the internal option
"-mllvm -pgo-instrument-entry" takes precedence over the index profile version.


https://reviews.llvm.org/D83024

Files:
  clang/test/CodeGenCXX/Inputs/profile-remap.proftext
  clang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
  compiler-rt/test/profile/Linux/counter_promo_for.c
  compiler-rt/test/profile/Linux/counter_promo_while.c
  compiler-rt/test/profile/Linux/instrprof-value-merge.c
  compiler-rt/test/profile/infinite_loop.c
  compiler-rt/test/profile/runtime_infinite.c
  llvm/include/llvm/ProfileData/InstrProfData.inc
  llvm/lib/Transforms/Instrumentation/CFGMST.h
  llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  llvm/test/Transforms/PGOProfile/Inputs/PR41279.proftext
  llvm/test/Transforms/PGOProfile/Inputs/PR41279_2.proftext
  llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
  llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
  llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
  llvm/test/Transforms/PGOProfile/PR41279.ll
  llvm/test/Transforms/PGOProfile/PR41279_2.ll
  llvm/test/Transforms/PGOProfile/branch2.ll
  llvm/test/Transforms/PGOProfile/counter_promo.ll
  llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll
  llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll
  llvm/test/Transforms/PGOProfile/criticaledge.ll
  llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
  llvm/test/Transforms/PGOProfile/indirectbr.ll
  llvm/test/Transforms/PGOProfile/irreducible.ll
  llvm/test/Transforms/PGOProfile/landingpad.ll
  llvm/test/Transforms/PGOProfile/loop1.ll
  llvm/test/Transforms/PGOProfile/loop2.ll
  llvm/test/Transforms/PGOProfile/misexpect-branch-stripped.ll
  llvm/test/Transforms/PGOProfile/misexpect-branch.ll
  llvm/test/Transforms/PGOProfile/misexpect-switch-default.ll
  llvm/test/Transforms/PGOProfile/misexpect-switch.ll
  llvm/test/Transforms/PGOProfile/switch.ll
  llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83024.275012.patch
Type: text/x-patch
Size: 73938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/40e29159/attachment.bin>


More information about the llvm-commits mailing list