[PATCH] D151589: [lld] add context-sensitive PGO options for MachO

Ellis Hoag via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 26 14:34:48 PDT 2023


ellis created this revision.
Herald added subscribers: wlei, ormris, wenlei, steven_wu, hiraditya.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
ellis added reviewers: int3, tejohnson, xur.
ellis updated this revision to Diff 526199.
ellis added a comment.
ellis edited the summary of this revision.
ellis edited the summary of this revision.
ellis edited the summary of this revision.
ellis published this revision for review.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Only pass flags when using lld


Enable support for CSPGO for lld MachO targets.

Since lld MachO does not support `-plugin-opt=`, we need to create the `--cs-profile-generate` and `--cs-profile-path=` options and propagate them in `Darwin.cpp`. These flags are not supported by ld64.

Also outline code into `getLastCSProfileGenerateArg()` to share between `CommonArgs.cpp` and `Darwin.cpp`.

CSPGO is already implemented for ELF (https://reviews.llvm.org/D56675) and COFF (https://reviews.llvm.org/D98763).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151589

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/cspgo-lto.c
  lld/MachO/Config.h
  lld/MachO/Driver.cpp
  lld/MachO/LTO.cpp
  lld/MachO/Options.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151589.526199.patch
Type: text/x-patch
Size: 7505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230526/2305882c/attachment-0001.bin>


More information about the cfe-commits mailing list