Skip to content

Make -sil-print-only-function take comma separated values #29433

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
Jan 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/SILOptimizer/PassManager/PassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ llvm::cl::opt<std::string> SILBreakOnPass(
"sil-break-on-pass", llvm::cl::init(""),
llvm::cl::desc("Break before running a particular function pass"));

llvm::cl::opt<std::string>
SILPrintOnlyFun("sil-print-only-function", llvm::cl::init(""),
llvm::cl::list<std::string>
SILPrintOnlyFun("sil-print-only-function", llvm::cl::CommaSeparated,
llvm::cl::desc("Only print out the sil for this function"));

llvm::cl::opt<std::string>
Expand Down Expand Up @@ -144,7 +144,8 @@ static llvm::cl::opt<DebugOnlyPassNumberOpt, true,
llvm::cl::ValueRequired);

static bool doPrintBefore(SILTransform *T, SILFunction *F) {
if (!SILPrintOnlyFun.empty() && F && F->getName() != SILPrintOnlyFun)
if (!SILPrintOnlyFun.empty() && F && SILPrintOnlyFun.end() ==
std::find(SILPrintOnlyFun.begin(), SILPrintOnlyFun.end(), F->getName()))
return false;

if (!SILPrintOnlyFuns.empty() && F &&
Expand All @@ -168,7 +169,8 @@ static bool doPrintBefore(SILTransform *T, SILFunction *F) {
}

static bool doPrintAfter(SILTransform *T, SILFunction *F, bool Default) {
if (!SILPrintOnlyFun.empty() && F && F->getName() != SILPrintOnlyFun)
if (!SILPrintOnlyFun.empty() && F && SILPrintOnlyFun.end() ==
std::find(SILPrintOnlyFun.begin(), SILPrintOnlyFun.end(), F->getName()))
return false;

if (!SILPrintOnlyFuns.empty() && F &&
Expand Down Expand Up @@ -207,7 +209,8 @@ static void printModule(SILModule *Mod, bool EmitVerboseSIL) {
return;
}
for (auto &F : *Mod) {
if (!SILPrintOnlyFun.empty() && F.getName().str() == SILPrintOnlyFun)
if (!SILPrintOnlyFun.empty() && SILPrintOnlyFun.end() !=
std::find(SILPrintOnlyFun.begin(), SILPrintOnlyFun.end(), F.getName()))
F.dump(EmitVerboseSIL);

if (!SILPrintOnlyFuns.empty() &&
Expand Down