[llvm-commits] [polly] r162901 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp lib/Exchange/ScopLib.cpp lib/Pocc.cpp

Tobias Grosser grosser at fim.uni-passau.de
Thu Aug 30 04:49:38 PDT 2012


Author: grosser
Date: Thu Aug 30 06:49:38 2012
New Revision: 162901

URL: http://llvm.org/viewvc/llvm-project?rev=162901&view=rev
Log:
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 at gmail.com>

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Exchange/ScopLib.cpp
    polly/trunk/lib/Pocc.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=162901&r1=162900&r2=162901&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu Aug 30 06:49:38 2012
@@ -309,6 +309,11 @@
   /// @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;
 

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=162901&r1=162900&r2=162901&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Aug 30 06:49:38 2012
@@ -676,6 +676,10 @@
   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();

Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=162901&r1=162900&r2=162901&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Thu Aug 30 06:49:38 2012
@@ -652,7 +652,7 @@
   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);

Modified: polly/trunk/lib/Pocc.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Pocc.cpp?rev=162901&r1=162900&r2=162901&view=diff
==============================================================================
--- polly/trunk/lib/Pocc.cpp (original)
+++ polly/trunk/lib/Pocc.cpp Thu Aug 30 06:49:38 2012
@@ -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 @@
     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 @@
 
   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 @@
   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";





More information about the llvm-commits mailing list