diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2017-07-24 12:43:27 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2017-07-24 12:43:27 +0000 |
| commit | 07e8c36dc73fa56357f0da4ac71c559fe952b31d (patch) | |
| tree | d6b599dea44fe7d77f43324496bc288365fc817f /polly/lib/Analysis | |
| parent | e2699b572e99110dc647a9f9dd1147b70db40412 (diff) | |
| download | bcm5719-llvm-07e8c36dc73fa56357f0da4ac71c559fe952b31d.tar.gz bcm5719-llvm-07e8c36dc73fa56357f0da4ac71c559fe952b31d.zip | |
[ForwardOpTree] Support read-only value uses.
Read-only values (values defined before the SCoP) require special
handing with -polly-analyze-read-only-scalars=true (which is the
default). If active, each use of a value requires a read access.
When a copied value uses a read-only value, we must also ensure that
such a MemoryAccess is available or is created.
Differential Revision: https://reviews.llvm.org/D35764
llvm-svn: 308876
Diffstat (limited to 'polly/lib/Analysis')
| -rw-r--r-- | polly/lib/Analysis/ScopBuilder.cpp | 15 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 16 |
2 files changed, 29 insertions, 2 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index f6b929ab73e..cf253bfa8cc 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -32,10 +32,12 @@ STATISTIC(RichScopFound, "Number of Scops containing a loop"); STATISTIC(InfeasibleScops, "Number of SCoPs with statically infeasible context."); -static cl::opt<bool> ModelReadOnlyScalars( +bool polly::ModelReadOnlyScalars; +static cl::opt<bool, true> XModelReadOnlyScalars( "polly-analyze-read-only-scalars", cl::desc("Model read-only scalar values in the scop description"), - cl::Hidden, cl::ZeroOrMore, cl::init(true), cl::cat(PollyCategory)); + cl::location(ModelReadOnlyScalars), cl::Hidden, cl::ZeroOrMore, + cl::init(true), cl::cat(PollyCategory)); static cl::opt<bool> UnprofitableScalarAccs( "polly-unprofitable-scalar-accs", @@ -778,6 +780,15 @@ void ScopBuilder::ensureValueWrite(Instruction *Inst) { } void ScopBuilder::ensureValueRead(Value *V, ScopStmt *UserStmt) { + // TODO: Make ScopStmt::ensureValueRead(Value*) offer the same functionality + // to be able to replace this one. Currently, there is a split responsibility. + // In a first step, the MemoryAccess is created, but without the + // AccessRelation. In the second step by ScopStmt::buildAccessRelations(), the + // AccessRelation is created. At least for scalar accesses, there is no new + // information available at ScopStmt::buildAccessRelations(), so we could + // create the AccessRelation right away. This is what + // ScopStmt::ensureValueRead(Value*) does. + auto *Scope = UserStmt->getSurroundingLoop(); auto VUse = VirtualUse::create(scop.get(), UserStmt, Scope, V, false); switch (VUse.getKind()) { diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 6defb4f1bb9..c1a30b9bad4 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -2042,6 +2042,22 @@ void ScopStmt::removeSingleMemoryAccess(MemoryAccess *MA) { } } +MemoryAccess *ScopStmt::ensureValueRead(Value *V) { + MemoryAccess *Access = lookupInputAccessOf(V); + if (Access) + return Access; + + ScopArrayInfo *SAI = + Parent.getOrCreateScopArrayInfo(V, V->getType(), {}, MemoryKind::Value); + Access = new MemoryAccess(this, nullptr, MemoryAccess::READ, V, V->getType(), + true, {}, {}, V, MemoryKind::Value); + Parent.addAccessFunction(Access); + Access->buildAccessRelation(SAI); + addAccess(Access); + Parent.addAccessData(Access); + return Access; +} + raw_ostream &polly::operator<<(raw_ostream &O, const ScopStmt &S) { S.print(O, PollyPrintInstructions); return O; |

