[llvm-commits] [polly] r157245 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp test/ScopInfo/loop_carry.ll utils/checkout_cloog.sh

Tobias Grosser grosser at fim.uni-passau.de
Tue May 22 03:47:27 PDT 2012


Author: grosser
Date: Tue May 22 05:47:27 2012
New Revision: 157245

URL: http://llvm.org/viewvc/llvm-project?rev=157245&view=rev
Log:
ScopInfo: Add parameter bounds to context

Derive the maximal and minimal values of a parameter from the type it has. Add
this information to the scop context. This information is needed, to derive
optimal types during code generation.

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/test/ScopInfo/loop_carry.ll
    polly/trunk/utils/checkout_cloog.sh

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=157245&r1=157244&r2=157245&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue May 22 05:47:27 2012
@@ -443,6 +443,9 @@
   /// @brief Build the Context of the Scop.
   void buildContext();
 
+  /// @brief Add the bounds of the parameters to the context.
+  void addParameterBounds();
+
   /// Build the Scop and Statement with precalculate scop information.
   void buildScop(TempScop &TempScop, const Region &CurRegion,
                   // Loops in Scop containing CurRegion

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=157245&r1=157244&r2=157245&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue May 22 05:47:27 2012
@@ -37,6 +37,7 @@
 #define DEBUG_TYPE "polly-scops"
 #include "llvm/Support/Debug.h"
 
+#include "isl/int.h"
 #include "isl/constraint.h"
 #include "isl/set.h"
 #include "isl/map.h"
@@ -755,6 +756,38 @@
   Context = isl_set_universe (Space);
 }
 
+void Scop::addParameterBounds() {
+  for (unsigned i = 0; i < isl_set_dim(Context, isl_dim_param); ++i) {
+    isl_int V;
+    isl_id *Id;
+    const SCEV *Scev;
+    const IntegerType *T;
+
+    Id = isl_set_get_dim_id(Context, isl_dim_param, i);
+    Scev = (const SCEV*) isl_id_get_user(Id);
+    T = dyn_cast<IntegerType>(Scev->getType());
+    isl_id_free(Id);
+
+    assert(T && "Not an integer type");
+    int Width = T->getBitWidth();
+
+    isl_int_init(V);
+
+    isl_int_set_si(V, 1);
+    isl_int_mul_2exp(V, V, Width-1);
+    isl_int_neg(V, V);
+    isl_set_lower_bound(Context, isl_dim_param, i, V);
+
+    isl_int_set_si(V, 1);
+    isl_int_mul_2exp(V, V, Width-1);
+    isl_int_sub_ui(V, V, 1);
+    isl_set_upper_bound(Context, isl_dim_param, i, V);
+
+    isl_int_clear(V);
+  }
+}
+
+
 void Scop::realignParams() {
   // Add all parameters into a common model.
   isl_space *Space = isl_space_params_alloc(IslCtx, ParameterIds.size());
@@ -790,6 +823,7 @@
   buildScop(tempScop, getRegion(), NestLoops, Scatter, LI);
 
   realignParams();
+  addParameterBounds();
 
   assert(NestLoops.empty() && "NestLoops not empty at top level!");
 }

Modified: polly/trunk/test/ScopInfo/loop_carry.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/loop_carry.ll?rev=157245&r1=157244&r2=157245&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/loop_carry.ll (original)
+++ polly/trunk/test/ScopInfo/loop_carry.ll Tue May 22 05:47:27 2012
@@ -47,7 +47,7 @@
 }
 
 ; CHECK: Context:
-; CHECK: [n] -> { : }
+; CHECK: [n] -> { : n >= -9223372036854775808 and n <= 9223372036854775807 }
 ; CHECK:     Statements {
 ; CHECK:     	Stmt_bb_nph
 ; CHECK:             Domain :=

Modified: polly/trunk/utils/checkout_cloog.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/checkout_cloog.sh?rev=157245&r1=157244&r2=157245&view=diff
==============================================================================
--- polly/trunk/utils/checkout_cloog.sh (original)
+++ polly/trunk/utils/checkout_cloog.sh Tue May 22 05:47:27 2012
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 CLOOG_HASH="57470e76bfd58a0c38c598e816411663193e0f45"
-ISL_HASH="2b54bb607bfc666dfee01c6332e347d0c253335f"
+ISL_HASH="edfaf3a8006bbf9f4dd7db7fef4035402e14dff6"
 
 PWD=`pwd`
 





More information about the llvm-commits mailing list