[all-commits] [llvm/llvm-project] 93cdd1: [PGO] Add ability to mark cold functions as optsiz...

Arthur Eubanks via All-commits all-commits at lists.llvm.org
Mon Feb 12 14:52:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 93cdd1b5cfa3735c599949b77e24dbfbe570441a
      https://github.com/llvm/llvm-project/commit/93cdd1b5cfa3735c599949b77e24dbfbe570441a
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M llvm/include/llvm/Support/PGOOptions.h
    A llvm/include/llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h
    M llvm/lib/LTO/LTOBackend.cpp
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassBuilderPipelines.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Support/PGOOptions.cpp
    M llvm/lib/Transforms/Instrumentation/CMakeLists.txt
    A llvm/lib/Transforms/Instrumentation/PGOForceFunctionAttrs.cpp
    A llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll
    M llvm/tools/opt/NewPMDriver.cpp
    M llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn

  Log Message:
  -----------
  [PGO] Add ability to mark cold functions as optsize/minsize/optnone (#69030)

The performance of cold functions shouldn't matter too much, so if we
care about binary sizes, add an option to mark cold functions as
optsize/minsize for binary size, or optnone for compile times [1]. Clang
patch will be in a future patch.

This is intended to replace `shouldOptimizeForSize(Function&, ...)`.
We've seen multiple cases where calls to this expensive function, if not
careful, can blow up compile times. I will clean up users of that
function in a followup patch.

Initial version: https://reviews.llvm.org/D149800

[1]
https://discourse.llvm.org/t/rfc-new-feature-proposal-de-optimizing-cold-functions-using-pgo-info/56388




More information about the All-commits mailing list