[PATCH] D85808: [remarks] Optimization remarks hotness filetering from profile summary

Wei Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 22:37:42 PDT 2020


weiwang created this revision.
Herald added subscribers: llvm-commits, cfe-commits, dang, dexonsmith, steven_wu, hiraditya, eraman, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: MaskRay.
Herald added projects: clang, LLVM.
weiwang requested review of this revision.

Expand remarks hotness threshold option `-fdiagnostics-hotness-threshold` in
clang driver command-line to utilize hotness threshold from profile summary.

Remarks hotness filtering relies on several driver options. Table below lists
how different options are correlated and affect final remarks outputs:

  | profile | hotness | threshold | remarks printed |
  |---------|---------|-----------|-----------------|
  | No      | No      | No        | All             |
  | No      | No      | Yes       | None            |
  | No      | Yes     | No        | All             |
  | No      | Yes     | Yes       | None            |
  | Yes     | No      | No        | All             |
  | Yes     | No      | Yes       | None            |
  | Yes     | Yes     | No        | All             |
  | Yes     | Yes     | Yes       | >=threshold     |

In the presence of profile summary, it is often more desirable to directly use
the hotness threshold from profile summary. The new argument value
`-fdiagnostics-hotness-threshold=auto` indicates threshold will be synced with
hotness threshold from profile summary during compilation. The "auto" threshold
relies on the availability of profile summary. In case of missing such
information, no remarks will be generated.

In order to make the option consistent across various tools, the support for the
new 'auto' argument is also available in the following tools:

  lld:                    `-opt-remarks-with-hotness=auto`
  llvm-lto:               `-lto-pass-remarks-hotness-threshold=auto`
  opt/llc:                `--pass-remarks-hotness-threshold=auto`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85808

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Frontend/CompilerInvocation.cpp
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/Options.td
  llvm/include/llvm/Analysis/ProfileSummaryInfo.h
  llvm/include/llvm/IR/LLVMContext.h
  llvm/include/llvm/IR/LLVMRemarkStreamer.h
  llvm/include/llvm/IR/Module.h
  llvm/include/llvm/LTO/Config.h
  llvm/include/llvm/LTO/LTO.h
  llvm/include/llvm/Remarks/HotnessThresholdParser.h
  llvm/lib/Analysis/OptimizationRemarkEmitter.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/IR/LLVMRemarkStreamer.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOCodeGenerator.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/test/Other/optimization-remarks-auto.ll
  llvm/test/Transforms/SampleProfile/Inputs/remarks-hotness.prof
  llvm/test/Transforms/SampleProfile/remarks-hotness.ll
  llvm/tools/llc/llc.cpp
  llvm/tools/opt/opt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85808.284966.patch
Type: text/x-patch
Size: 39074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200812/f81b9909/attachment-0001.bin>


More information about the cfe-commits mailing list