@@ -49,6 +49,12 @@ ForceInlineFunctions("force-inline",
49
49
cl::Hidden,
50
50
cl::cat(BoltOptCategory));
51
51
52
+ static cl::list<std::string> SkipInlineFunctions (
53
+ " skip-inline" , cl::CommaSeparated,
54
+ cl::desc (" list of functions to never consider for inlining" ),
55
+ cl::value_desc(" func1,func2,func3,..." ), cl::Hidden,
56
+ cl::cat(BoltOptCategory));
57
+
52
58
static cl::opt<bool > InlineAll (" inline-all" , cl::desc(" inline all functions" ),
53
59
cl::cat(BoltOptCategory));
54
60
@@ -105,6 +111,12 @@ bool mustConsider(const llvm::bolt::BinaryFunction &Function) {
105
111
return false ;
106
112
}
107
113
114
+ bool mustSkip (const llvm::bolt::BinaryFunction &Function) {
115
+ return llvm::any_of (opts::SkipInlineFunctions, [&](const std::string &Name) {
116
+ return Function.hasName (Name);
117
+ });
118
+ }
119
+
108
120
void syncOptions () {
109
121
if (opts::InlineIgnoreCFI)
110
122
opts::InlineIgnoreLeafCFI = true ;
@@ -223,7 +235,7 @@ InliningInfo getInliningInfo(const BinaryFunction &BF) {
223
235
void Inliner::findInliningCandidates (BinaryContext &BC) {
224
236
for (const auto &BFI : BC.getBinaryFunctions ()) {
225
237
const BinaryFunction &Function = BFI.second ;
226
- if (!shouldOptimize (Function))
238
+ if (!shouldOptimize (Function) || opts::mustSkip (Function) )
227
239
continue ;
228
240
const InliningInfo InlInfo = getInliningInfo (Function);
229
241
if (InlInfo.Type != INL_NONE)
0 commit comments