mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user