diff options
| author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-06-09 08:23:40 +0000 |
|---|---|---|
| committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-06-09 08:23:40 +0000 |
| commit | 286c916dde2ba341b7442b3433c6f07fea37fd65 (patch) | |
| tree | 3e41f9f82580448ca60d1e895a2e4dd1147cace2 /polly/lib/Analysis/ScopDetection.cpp | |
| parent | add20f8f17c0cfada2bf1e85ab921c0530cb1be7 (diff) | |
| download | bcm5719-llvm-286c916dde2ba341b7442b3433c6f07fea37fd65.tar.gz bcm5719-llvm-286c916dde2ba341b7442b3433c6f07fea37fd65.zip | |
[Polly] [ScopDetection] Allow passing multiple functions to `-polly-only-func`.
- This is useful to run optimisations on only certain functions.
Differential Revision: https://reviews.llvm.org/D33990
llvm-svn: 305060
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 0d364145d30..9aa13b49279 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -90,11 +90,13 @@ static cl::opt<bool, true> XPollyProcessUnprofitable( cl::location(PollyProcessUnprofitable), cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory)); -static cl::opt<std::string> OnlyFunction( +static cl::list<std::string> OnlyFunctions( "polly-only-func", - cl::desc("Only run on functions that contain a certain string"), - cl::value_desc("string"), cl::ValueRequired, cl::init(""), - cl::cat(PollyCategory)); + cl::desc("Only run on functions that contain a certain string. " + "Multiple strings can be comma separated. " + "Scop detection will run on all functions that contain " + "any of the strings provided."), + cl::ZeroOrMore, cl::CommaSeparated, cl::cat(PollyCategory)); static cl::opt<bool> AllowFullFunction("polly-detect-full-functions", @@ -271,6 +273,12 @@ void DiagnosticScopFound::print(DiagnosticPrinter &DP) const { DP << FileName << ":" << ExitLine << ": End of scop"; } +static bool IsFnNameListedInOnlyFunctions(StringRef FnName) { + for (auto Name : OnlyFunctions) + if (FnName.count(Name) > 0) + return true; + return false; +} //===----------------------------------------------------------------------===// // ScopDetection. @@ -284,7 +292,7 @@ ScopDetection::ScopDetection(Function &F, const DominatorTree &DT, Region *TopRegion = RI.getTopLevelRegion(); - if (OnlyFunction != "" && !F.getName().count(OnlyFunction)) + if (OnlyFunctions.size() > 0 && !IsFnNameListedInOnlyFunctions(F.getName())) return; if (!isValidFunction(F)) |

