Add -sil-inline-never-function flag (#32660)

-sil-inline-never-functions already exists, but it does a substring
match. This is not desired all the time. Add
-sil-inline-never-function flag that does a full string match and avoids
inlining functions with that name
This commit is contained in:
Meghana Gupta
2020-07-01 15:10:21 -07:00
committed by GitHub
parent 890df57515
commit 906b3cbafb
2 changed files with 12 additions and 1 deletions

View File

@@ -19,6 +19,10 @@ llvm::cl::opt<std::string>
SILInlineNeverFuns("sil-inline-never-functions", llvm::cl::init(""),
llvm::cl::desc("Never inline functions whose name "
"includes this string."));
llvm::cl::list<std::string>
SILInlineNeverFun("sil-inline-never-function", llvm::cl::CommaSeparated,
llvm::cl::desc("Never inline functions whose name "
"is this string"));
//===----------------------------------------------------------------------===//
// ConstantTracker
@@ -697,6 +701,13 @@ SILFunction *swift::getEligibleFunction(FullApplySite AI,
&& Callee->getName().find(SILInlineNeverFuns, 0) != StringRef::npos)
return nullptr;
if (!SILInlineNeverFun.empty() &&
SILInlineNeverFun.end() != std::find(SILInlineNeverFun.begin(),
SILInlineNeverFun.end(),
Callee->getName())) {
return nullptr;
}
if (!Callee->shouldOptimize()) {
return nullptr;
}