summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-02-19 05:31:07 +0000
committerTobias Grosser <tobias@grosser.es>2015-02-19 05:31:07 +0000
commitd1e33e7061126d181f63b3e1019cf3f11269deff (patch)
tree9f4b995f03b9cdea2228cd1c755000014926d0f8 /polly/lib/Analysis/ScopDetection.cpp
parent3e1551c96f5ca7217ba850dd77c6f3702004c07a (diff)
downloadbcm5719-llvm-d1e33e7061126d181f63b3e1019cf3f11269deff.tar.gz
bcm5719-llvm-d1e33e7061126d181f63b3e1019cf3f11269deff.zip
ScopDetection: Only detect scops that have at least one read and one write
Scops that only read seem generally uninteresting and scops that only write are most likely initializations where there is also little to optimize. To not waste compile time we bail early. Differential Revision: http://reviews.llvm.org/D7735 llvm-svn: 229820
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 4bb2b15cb41..8ef657a967a 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -84,6 +84,11 @@ static cl::opt<bool>
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
+static cl::opt<bool> DetectUnprofitable("polly-detect-unprofitable",
+ cl::desc("Detect unprofitable scops"),
+ cl::Hidden, cl::init(false),
+ cl::ZeroOrMore, cl::cat(PollyCategory));
+
static cl::opt<std::string> OnlyFunction(
"polly-only-func",
cl::desc("Only run on functions that contain a certain string"),
@@ -623,8 +628,11 @@ bool ScopDetection::isValidInstruction(Instruction &Inst,
}
// Check the access function.
- if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
+ if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst)) {
+ Context.hasStores |= isa<StoreInst>(Inst);
+ Context.hasLoads |= isa<LoadInst>(Inst);
return isValidMemoryAccess(Inst, Context);
+ }
// We do not know this instruction, therefore we assume it is invalid.
return invalid<ReportUnknownInst>(Context, /*Assert=*/true, &Inst);
@@ -868,6 +876,11 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const {
if (!allBlocksValid(Context))
return false;
+ // We can probably not do a lot on scops that only write or only read
+ // data.
+ if (!DetectUnprofitable && (!Context.hasStores || !Context.hasLoads))
+ invalid<ReportUnprofitable>(Context, /*Assert=*/true);
+
DEBUG(dbgs() << "OK\n");
return true;
}
OpenPOWER on IntegriCloud