diff options
| author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-08-17 21:57:23 +0000 |
|---|---|---|
| committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-08-17 21:57:23 +0000 |
| commit | b46847c035703f1f3c6a6f8c6833daf7c381b8a1 (patch) | |
| tree | 899661e9600d24bd33c0b2779b2beb7c9a6e05e1 /polly/lib/Analysis/ScopDetection.cpp | |
| parent | e608ef76357e1dcedf7e49e6c4f43468b9431812 (diff) | |
| download | bcm5719-llvm-b46847c035703f1f3c6a6f8c6833daf7c381b8a1.tar.gz bcm5719-llvm-b46847c035703f1f3c6a6f8c6833daf7c381b8a1.zip | |
[ScopInliner] Add a simple Scop-based inliner to polly.
We add a ScopInliner pass which inlines functions based on a simple heuristic:
Let `g` call `f`.
If we can model all of `f` as a Scop, we inline `f` into `g`.
This requires `-polly-detect-full-function` to be enabled. So, the pass
asserts that `-polly-detect-full-function` is enabled.
Differential Revision: https://reviews.llvm.org/D36832
llvm-svn: 311126
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 18496d487b8..6b5ed8408e0 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1,4 +1,3 @@ -//===----- ScopDetection.cpp - Detect Scops --------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -107,10 +106,12 @@ static cl::list<std::string> IgnoredFunctions( "ANY of the regexes provided."), cl::ZeroOrMore, cl::CommaSeparated, cl::cat(PollyCategory)); -static cl::opt<bool> - AllowFullFunction("polly-detect-full-functions", - cl::desc("Allow the detection of full functions"), - cl::init(false), cl::cat(PollyCategory)); +bool polly::PollyAllowFullFunction; +static cl::opt<bool, true> + XAllowFullFunction("polly-detect-full-functions", + cl::desc("Allow the detection of full functions"), + cl::location(polly::PollyAllowFullFunction), + cl::init(false), cl::cat(PollyCategory)); static cl::opt<std::string> OnlyRegion( "polly-only-region", @@ -1541,7 +1542,7 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const { DEBUG(dbgs() << "Checking region: " << CurRegion.getNameStr() << "\n\t"); - if (!AllowFullFunction && CurRegion.isTopLevelRegion()) { + if (!PollyAllowFullFunction && CurRegion.isTopLevelRegion()) { DEBUG(dbgs() << "Top level region is invalid\n"); return false; } @@ -1564,7 +1565,7 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const { // SCoP cannot contain the entry block of the function, because we need // to insert alloca instruction there when translate scalar to array. - if (!AllowFullFunction && + if (!PollyAllowFullFunction && CurRegion.getEntry() == &(CurRegion.getEntry()->getParent()->getEntryBlock())) return invalid<ReportEntry>(Context, /*Assert=*/true, CurRegion.getEntry()); |

