[PATCH] D92806: Single function compilation mode.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 18:35:57 PST 2020


hoy created this revision.
Herald added subscribers: wenlei, hiraditya.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As I worked on analyzing hot spots for large applications I found that iterating on a particular function was painful primarily because recompilation took a long time. For example, compiling SPEC2017/blender in LTO mode takes 30 minutes. Also a debug-only dump is huge since that has to be done for all functions. In this change we are introducing a single method compilation mode via -mllvm -single-func=FuncName. With this new switch, only a function and optionally all callee functions reachable from the specified function will be compiled. This aims at compiling the minimal part of the program to replay the compilation of the user-specified function.
It might be never possible to replay a method compilation accurately without compiling the whole program. For example, a top-down interprocedural pass may propagate a value down from the root entry to the target function. A callee function on the path from entry to the target may return a value that contributes to the target compilation. That said, this change can still help if the compilation it triggers generates the same code with the original full compilation.
To minimized callee function exploding, a profile is used to narrow down the potential indirect call targets. Without a profile, alias analysis or type analysis can be used instead. This is not done in this change.
The mode works with non-LTO, thinLTO and fullLTO modes.

Test Plan:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92806

Files:
  llvm/include/llvm/Transforms/IPO/FuncExtractor.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/ExtractGV.cpp
  llvm/test/Other/extract-func.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92806.310070.patch
Type: text/x-patch
Size: 16462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201208/a7d50f00/attachment.bin>


More information about the llvm-commits mailing list