Skip to content

Add a new -sil-disable-only-function flag #32622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2020

Conversation

meg-gupta
Copy link
Contributor

This will enable us apply -sil-disable-pass only on certain functions

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can you add a test for this? After that + comments LGTM!

@@ -87,6 +87,9 @@ llvm::cl::list<std::string>
SILDisablePass("sil-disable-pass", llvm::cl::CommaSeparated,
llvm::cl::desc("Disable passes "
"which contain a string from this list"));
llvm::cl::list<std::string> SILDisableOnlyFun(
"sil-disable-only-function", llvm::cl::CommaSeparated,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add pass to the name? Maybe: -sil-disable-pass-only-function=. Then it is really clear.

@@ -592,7 +601,7 @@ runFunctionPasses(unsigned FromTransIdx, unsigned ToTransIdx) {

void SILPassManager::runModulePass(unsigned TransIdx) {
auto *SMT = cast<SILModuleTransform>(Transformations[TransIdx]);
if (isDisabled(SMT))
if (isDisabled(SMT, nullptr))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a default nullptr value?

static bool isDisabled(SILTransform *T) {
static bool isDisabled(SILTransform *T, SILFunction *F) {
if (!SILDisableOnlyFun.empty() && F &&
SILDisableOnlyFun.end() == std::find(SILDisableOnlyFun.begin(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, we have a range for std::find, no?

This will enable us apply -sil-disable-pass only on certain functions
@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta meg-gupta merged commit 337c4e8 into swiftlang:master Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants