[PATCH] D96197: [CSSPGO] Add switches to control prelink/postlink inline separately
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 22:24:37 PST 2021
wenlei updated this revision to Diff 322596.
wenlei added a comment.
rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96197/new/
https://reviews.llvm.org/D96197
Files:
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -177,6 +177,10 @@
"order of call graph during sample profile loading. It only "
"works for new pass manager. "));
+static cl::opt<bool> EnableSampleProfileInline(
+ "enable-sample-profile-inline", cl::Hidden, cl::init(true),
+ cl::desc("Enable Inlining from sample profile loader."));
+
static cl::opt<bool> ProfileSizeInline(
"sample-profile-inline-size", cl::Hidden, cl::init(false),
cl::desc("Inline cold call sites in profile loader if it's beneficial "
@@ -1341,6 +1345,11 @@
bool SampleProfileLoader::tryInlineCandidate(
InlineCandidate &Candidate, SmallVector<CallBase *, 8> *InlinedCallSites) {
+ // Disable only the inlining part of sample profile loader, and still
+ // perform profile annotation, ICP as well as computing import GUIDs for
+ // ThinLTO's pre-link.
+ if (!EnableSampleProfileInline)
+ return false;
CallBase &CB = *Candidate.CallInstr;
Function *CalledFunction = CB.getCalledFunction();
Index: llvm/lib/Transforms/IPO/Inliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Inliner.cpp
+++ llvm/lib/Transforms/IPO/Inliner.cpp
@@ -99,6 +99,10 @@
"by inlining from cgscc inline remarks."),
cl::Hidden);
+static cl::opt<bool>
+ EnableRegularCGSCCInline("enable-cgscc-inline", cl::init(true), cl::Hidden,
+ cl::desc("Enable CGSCC Inlining"));
+
LegacyInlinerBase::LegacyInlinerBase(char &ID) : CallGraphSCCPass(ID) {}
LegacyInlinerBase::LegacyInlinerBase(char &ID, bool InsertLifetime)
@@ -1006,7 +1010,8 @@
// because it makes profile annotation in the backend inaccurate.
if (MandatoryFirst)
PM.addPass(InlinerPass(/*OnlyMandatory*/ true));
- PM.addPass(InlinerPass());
+ if (EnableRegularCGSCCInline)
+ PM.addPass(InlinerPass());
}
PreservedAnalyses ModuleInlinerWrapperPass::run(Module &M,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96197.322596.patch
Type: text/x-patch
Size: 2121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210210/2bcc6926/attachment.bin>
More information about the llvm-commits
mailing list