1. [InlineAdvisor] New inliner advisor to replay inlining from optimization remarks (details)
  2. [gn build] Port 577e58bcc75 (details)
  3. [llvm-libtool-darwin] Speculative buildbot fix (details)
Commit 577e58bcc754cea2ae0358a5359ac5cc48d8e9d0 by aktoon
[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks

This change added a new inline advisor that takes optimization remarks from previous inlining as input, and provides the decision as advice so current inlining can replay inline decisions of a different compilation. Dwarf inline stack with line and discriminator is used as anchor for call sites including call context. The change can be useful for Inliner tuning as it provides a channel to allow external input for tweaking inline decisions. Existing alternatives like alwaysinline attribute is per-function, not per-callsite. Per-callsite inline intrinsic can be another solution (not yet existing), but it's intrusive to implement and also does not differentiate call context.

A switch -sample-profile-inline-replay=<inline_remarks_file> is added to hook up the new inline advisor with SampleProfileLoader's inline decision for replay. Since SampleProfileLoader does top-down inlining, inline decision can be specialized for each call context, hence we should be able to replay inlining accurately. However with a bottom-up inliner like CGSCC inlining, the replay can be limited due to lack of specialization for different call context. Apart from that limitation, the new inline advisor can still be used by regular CGSCC inliner later if needed for tuning purpose.

This is a resubmit of
The file was addedllvm/test/Transforms/SampleProfile/Inputs/inline-replay.txt
The file was modifiedllvm/lib/Transforms/IPO/SampleProfile.cpp
The file was addedllvm/include/llvm/Analysis/ReplayInlineAdvisor.h
The file was modifiedllvm/lib/Analysis/CMakeLists.txt
The file was addedllvm/lib/Analysis/ReplayInlineAdvisor.cpp
The file was modifiedllvm/lib/Analysis/InlineAdvisor.cpp
The file was modifiedllvm/include/llvm/Analysis/InlineAdvisor.h
The file was addedllvm/test/Transforms/SampleProfile/inline-replay.ll
Commit 1bc298aa125c7dd0e1bd7bf7b2280254633f161c by llvmgnsyncbot
[gn build] Port 577e58bcc75
The file was modifiedllvm/utils/gn/secondary/llvm/lib/Analysis/
Commit 12b4df991950bea1d99b32e0babaf21eeb0ab4df by smeenai
[llvm-libtool-darwin] Speculative buildbot fix is failing
this test. Attempt to explicitly use the Mach-O dump format as a
speculative fix.
The file was modifiedllvm/test/tools/llvm-libtool-darwin/universal-output.test