[all-commits] [llvm/llvm-project] 7a6c89: [SampleFDO] Add use-sample-profile function attrib...

wmi-11 via All-commits all-commits at lists.llvm.org
Tue Jun 2 17:42:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a6c89427c9babc8e4a69e8a2b61bbf4a4b80c56
      https://github.com/llvm/llvm-project/commit/7a6c89427c9babc8e4a69e8a2b61bbf4a4b80c56
  Author: Wei Mi <wmi at google.com>
  Date:   2020-06-02 (Tue, 02 Jun 2020)

  Changed paths:
    M clang/lib/CodeGen/CodeGenFunction.cpp
    A clang/test/CodeGen/use-sample-profile-attr.c
    M llvm/include/llvm/IR/Attributes.td
    M llvm/lib/Transforms/IPO/SampleProfile.cpp
    M llvm/test/LTO/Resolution/X86/load-sample-prof-icp.ll
    M llvm/test/LTO/Resolution/X86/load-sample-prof-lto.ll
    M llvm/test/LTO/Resolution/X86/load-sample-prof.ll
    A llvm/test/Transforms/Inline/inline-incompat-attrs.ll
    A llvm/test/Transforms/Inline/partial-inline-incompat-attrs.ll
    M llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.ll
    A llvm/test/Transforms/SampleProfile/Inputs/use-sample-profile-attr.prof
    M llvm/test/Transforms/SampleProfile/branch.ll
    M llvm/test/Transforms/SampleProfile/calls.ll
    M llvm/test/Transforms/SampleProfile/cold-indirect-call.ll
    M llvm/test/Transforms/SampleProfile/cov-zero-samples.ll
    M llvm/test/Transforms/SampleProfile/coverage-warning.ll
    M llvm/test/Transforms/SampleProfile/discriminator.ll
    M llvm/test/Transforms/SampleProfile/early-inline.ll
    M llvm/test/Transforms/SampleProfile/entry_counts.ll
    M llvm/test/Transforms/SampleProfile/entry_counts_cold.ll
    M llvm/test/Transforms/SampleProfile/entry_counts_missing_dbginfo.ll
    M llvm/test/Transforms/SampleProfile/fnptr.ll
    M llvm/test/Transforms/SampleProfile/function_metadata.ll
    M llvm/test/Transforms/SampleProfile/gcc-simple.ll
    M llvm/test/Transforms/SampleProfile/indirect-call-gcc.ll
    M llvm/test/Transforms/SampleProfile/indirect-call.ll
    M llvm/test/Transforms/SampleProfile/inline-callee-update.ll
    M llvm/test/Transforms/SampleProfile/inline-cold-callsite-samplepgo.ll
    M llvm/test/Transforms/SampleProfile/inline-cold.ll
    M llvm/test/Transforms/SampleProfile/inline-combine.ll
    M llvm/test/Transforms/SampleProfile/inline-coverage.ll
    M llvm/test/Transforms/SampleProfile/inline-mergeprof.ll
    M llvm/test/Transforms/SampleProfile/inline-stats.ll
    M llvm/test/Transforms/SampleProfile/inline-topdown.ll
    M llvm/test/Transforms/SampleProfile/inline.ll
    M llvm/test/Transforms/SampleProfile/nolocinfo.ll
    M llvm/test/Transforms/SampleProfile/offset.ll
    M llvm/test/Transforms/SampleProfile/profile-format-compress.ll
    M llvm/test/Transforms/SampleProfile/profile-format.ll
    M llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll
    M llvm/test/Transforms/SampleProfile/propagate.ll
    M llvm/test/Transforms/SampleProfile/remap.ll
    M llvm/test/Transforms/SampleProfile/remarks.ll
    M llvm/test/Transforms/SampleProfile/section-accurate-samplepgo.ll
    M llvm/test/Transforms/SampleProfile/syntax.ll
    A llvm/test/Transforms/SampleProfile/use-sample-profile-attr.ll
    M llvm/test/Transforms/SampleProfile/warm-inline-instance.ll

  Log Message:
  -----------
  [SampleFDO] Add use-sample-profile function attribute.

When sampleFDO is enabled, people may expect they can use
-fno-profile-sample-use to opt-out using sample profile for a certain file.
That could be either for debugging purpose or for performance tuning purpose.
However, when thinlto is enabled, if a function in file A compiled with
-fno-profile-sample-use is imported to another file B compiled with
-fprofile-sample-use, the inlined copy of the function in file B may still
get its profile annotated.

The inconsistency may even introduce profile unused warning because if the
target is not compiled with explicit debug information flag, the function
in file A won't have its debug information enabled (debug information will
be enabled implicitly only when -fprofile-sample-use is used). After it is
imported into file B which is compiled with -fprofile-sample-use, profile
annotation for the outline copy of the function will fail because the
function has no debug information, and that will trigger  profile unused
warning.

We add a new attribute use-sample-profile to control whether a function
will use its sample profile no matter for its outline or inline copies.
That will make the behavior of -fno-profile-sample-use consistent.

Differential Revision: https://reviews.llvm.org/D79959




More information about the All-commits mailing list