diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-08-30 11:49:38 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-08-30 11:49:38 +0000 |
commit | cd95b773305c743eb44430a530481e1577bf67ac (patch) | |
tree | 941c19b044885fc9b1b411e5ff752d626ba55a1c | |
parent | 4a7527e0ebdc5d4479103a5d19992375eaf69f98 (diff) | |
download | bcm5719-llvm-cd95b773305c743eb44430a530481e1577bf67ac.tar.gz bcm5719-llvm-cd95b773305c743eb44430a530481e1577bf67ac.zip |
Pocc: Fix some bugs in the PoCC optimizer pass
This includes:
- The isl_id of the domain of the scattering must be copied from the original
domain
- Remove outdated references to a 'FinalRead' statement
- Print of the Pocc output, if -debug is provided.
- Add line breaks to some error messages.
Reported and Debugged by: Dustin Feld <d3.feld@gmail.com>
llvm-svn: 162901
-rwxr-xr-x | polly/include/polly/ScopInfo.h | 5 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 4 | ||||
-rw-r--r-- | polly/lib/Exchange/ScopLib.cpp | 2 | ||||
-rw-r--r-- | polly/lib/Pocc.cpp | 23 |
4 files changed, 24 insertions, 10 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 10cc81d2a25..edb30ece5ed 100755 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -309,6 +309,11 @@ public: /// @return The space of the iteration domain isl_space *getDomainSpace() const; + /// @brief Get the id of the iteration domain space + /// + /// @return The id of the iteration domain space + isl_id *getDomainId() const; + /// @brief Get an isl string representing this domain. std::string getDomainStr() const; diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index dfb0e8fc523..758752bc03c 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -676,6 +676,10 @@ isl_space *ScopStmt::getDomainSpace() const { return isl_set_get_space(Domain); } +isl_id *ScopStmt::getDomainId() const { + return isl_set_get_tuple_id(Domain); +} + ScopStmt::~ScopStmt() { while (!MemAccs.empty()) { delete MemAccs.back(); diff --git a/polly/lib/Exchange/ScopLib.cpp b/polly/lib/Exchange/ScopLib.cpp index d58f0741f64..f094c490fee 100644 --- a/polly/lib/Exchange/ScopLib.cpp +++ b/polly/lib/Exchange/ScopLib.cpp @@ -652,7 +652,7 @@ isl_map *scatteringForStmt(scoplib_matrix_p m, ScopStmt *PollyStmt, isl_space_free(ParamSpace); Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering"); - Space = isl_space_set_tuple_name(Space, isl_dim_in, PollyStmt->getBaseName()); + Space = isl_space_set_tuple_id(Space, isl_dim_in, PollyStmt->getDomainId()); if (scatteringDims == -1) return mapFromMatrix(m, Space); diff --git a/polly/lib/Pocc.cpp b/polly/lib/Pocc.cpp index a59c95759e4..df8702a2c87 100644 --- a/polly/lib/Pocc.cpp +++ b/polly/lib/Pocc.cpp @@ -24,6 +24,8 @@ #include "polly/ScheduleOptimizer.h" #include "polly/ScopInfo.h" +#define DEBUG_TYPE "polly-opt-pocc" +#include "llvm/Support/Debug.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" #include "llvm/Support/MemoryBuffer.h" @@ -62,20 +64,17 @@ namespace { virtual bool runOnScop(Scop &S); void printScop(llvm::raw_ostream &OS) const; void getAnalysisUsage(AnalysisUsage &AU) const; + + private: + bool runTransform(Scop &S); }; } char Pocc::ID = 0; -bool Pocc::runOnScop(Scop &S) { +bool Pocc::runTransform(Scop &S) { Dependences *D = &getAnalysis<Dependences>(); - // Only the final read statement in the SCoP. No need to optimize anything. - // (In case we would try, Pocc complains that there is no statement in the - // SCoP). - if (S.begin() + 1 == S.end()) - return false; - // Create the scop file. sys::Path tempDir = sys::Path::GetTemporaryDirectory(); sys::Path scopFile = tempDir; @@ -234,6 +233,12 @@ bool Pocc::runOnScop(Scop &S) { return false; } +bool Pocc::runOnScop(Scop &S) { + bool Result = runTransform(S); + DEBUG(printScop(dbgs())); + + return Result; +} void Pocc::printScop(raw_ostream &OS) const { OwningPtr<MemoryBuffer> stdoutBuffer; @@ -249,14 +254,14 @@ void Pocc::printScop(raw_ostream &OS) const { OS << "\n"; if (error_code ec = MemoryBuffer::getFile(plutoStdout.c_str(), stdoutBuffer)) - OS << "Could not open pocc stdout file: " + ec.message(); + OS << "Could not open pocc stdout file: " + ec.message() << "\n"; else { OS << "pocc stdout: " << stdoutBuffer->getBufferIdentifier() << "\n"; OS << stdoutBuffer->getBuffer() << "\n"; } if (error_code ec = MemoryBuffer::getFile(plutoStderr.c_str(), stderrBuffer)) - OS << "Could not open pocc stderr file: " + ec.message(); + OS << "Could not open pocc stderr file: " + ec.message() << "\n"; else { OS << "pocc stderr: " << plutoStderr.c_str() << "\n"; OS << stderrBuffer->getBuffer() << "\n"; |