[PATCH] D89078: Add `-f[no-]split-cold-code` toggling outlining & enable in -O

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 16:21:32 PDT 2020


compnerd created this revision.
compnerd added reviewers: vsk, rnk.
Herald added subscribers: llvm-commits, cfe-commits, dang, hiraditya.
Herald added projects: clang, LLVM.
compnerd requested review of this revision.

In order for the hot/cold splitting pass to graduate out of
experimental status, users need some way to safely enable it.

The current method of passing -mllvm -hot-cold-split=true to clang is
not safe, because directly setting a `cl::opt` cannot interact well with
other CC1 options (e.g. -O0, or `-disable-llvm-passes`).

This patch adds -f[no-]split-cold-code CC1 options to clang so that the
splitting pass can be toggled/combined with other options without issue.
This makes it possible to deploy the new pass on a large scale.

Patch by Vedant Kumar <vsk at apple.com>!

This is extracted from the patches from the Swift contributed changes to
LLVM at https://github.com/llvm/llvm-project-staging/.

The few test changes here are to allow the tests to continue working
unperturbed.

This has been shipping with the Apple toolchain and has been tested.
The known deficiencies of the outlining here are the incorrect handling
for Windows EH unwind pads which are sometimes duplicately outlined
incorrectly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89078

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/split-cold-code.c
  clang/test/CodeGenCXX/microsoft-abi-typeid.cpp
  clang/test/CodeGenCXX/nrvo.cpp
  clang/test/CodeGenObjC/synchronized.m
  clang/test/CodeGenObjCXX/exceptions-legacy.mm
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89078.297074.patch
Type: text/x-patch
Size: 14542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201008/fca7bf95/attachment.bin>


More information about the llvm-commits mailing list