summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopBuilder.cpp
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-12-11 12:51:24 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-12-11 12:51:24 +0000
commit5f0e8a46cf7be4cfb1d30a70c56734ab0eafe2db (patch)
tree14999267fd9e58a23dd293ed2a7a2fec0b36d297 /polly/lib/Analysis/ScopBuilder.cpp
parentdc31c61b18f01b21e18ccea4de0a010569e81887 (diff)
downloadbcm5719-llvm-5f0e8a46cf7be4cfb1d30a70c56734ab0eafe2db.tar.gz
bcm5719-llvm-5f0e8a46cf7be4cfb1d30a70c56734ab0eafe2db.zip
[ScopBuilder] Split statements on encountering store instructions.
Introduce -polly-stmt-granularity=store option. Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in> Differential Revision: https://reviews.llvm.org/D37337 llvm-svn: 320360
Diffstat (limited to 'polly/lib/Analysis/ScopBuilder.cpp')
-rw-r--r--polly/lib/Analysis/ScopBuilder.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp
index 44aec902c41..3c7f67be0ec 100644
--- a/polly/lib/Analysis/ScopBuilder.cpp
+++ b/polly/lib/Analysis/ScopBuilder.cpp
@@ -103,7 +103,7 @@ static cl::opt<bool> DisableMultiplicativeReductions(
cl::desc("Disable multiplicative reductions"), cl::Hidden, cl::ZeroOrMore,
cl::init(false), cl::cat(PollyCategory));
-enum class GranularityChoice { BasicBlocks, ScalarIndependence };
+enum class GranularityChoice { BasicBlocks, ScalarIndependence, Stores };
static cl::opt<GranularityChoice> StmtGranularity(
"polly-stmt-granularity",
@@ -112,7 +112,9 @@ static cl::opt<GranularityChoice> StmtGranularity(
cl::values(clEnumValN(GranularityChoice::BasicBlocks, "bb",
"One statement per basic block"),
clEnumValN(GranularityChoice::ScalarIndependence, "scalar-indep",
- "Scalar independence heuristic")),
+ "Scalar independence heuristic"),
+ clEnumValN(GranularityChoice::Stores, "store",
+ "Store-level granularity")),
cl::init(GranularityChoice::BasicBlocks), cl::cat(PollyCategory));
void ScopBuilder::buildPHIAccesses(ScopStmt *PHIStmt, PHINode *PHI,
@@ -686,7 +688,7 @@ bool ScopBuilder::shouldModelInst(Instruction *Inst, Loop *L) {
!canSynthesize(Inst, *scop, &SE, L);
}
-void ScopBuilder::buildSequentialBlockStmts(BasicBlock *BB) {
+void ScopBuilder::buildSequentialBlockStmts(BasicBlock *BB, bool SplitOnStore) {
Loop *SurroundingLoop = LI.getLoopFor(BB);
int Count = 0;
@@ -694,7 +696,8 @@ void ScopBuilder::buildSequentialBlockStmts(BasicBlock *BB) {
for (Instruction &Inst : *BB) {
if (shouldModelInst(&Inst, SurroundingLoop))
Instructions.push_back(&Inst);
- if (Inst.getMetadata("polly_split_after")) {
+ if (Inst.getMetadata("polly_split_after") ||
+ (SplitOnStore && isa<StoreInst>(Inst))) {
scop->addScopStmt(BB, SurroundingLoop, Instructions, Count);
Count++;
Instructions.clear();
@@ -900,6 +903,9 @@ void ScopBuilder::buildStmts(Region &SR) {
case GranularityChoice::ScalarIndependence:
buildEqivClassBlockStmts(BB);
break;
+ case GranularityChoice::Stores:
+ buildSequentialBlockStmts(BB, true);
+ break;
}
}
}
OpenPOWER on IntegriCloud