[llvm-commits] [polly] r158015 - /polly/trunk/lib/CodeGen/Cloog.cpp

Tobias Grosser grosser at fim.uni-passau.de
Tue Jun 5 12:31:09 PDT 2012


Author: grosser
Date: Tue Jun  5 14:31:08 2012
New Revision: 158015

URL: http://llvm.org/viewvc/llvm-project?rev=158015&view=rev
Log:
CLooG: Do not take into account the context

CLooG and the CLooG based code generation does not yet correctly derive the
types of the expressions, but just uses i64 for everything. This is incorrect,
but works normally pretty well. However, the recent change of adding parameter
bounds to the context made CLooG generate expressions that contain a lot of very
large integers that possibly don't fit into an i64. This broke the code
generation for several benchmarks.

To get the CLooG based code generation working again, we just don't take into
account any constraints in the context. This brings us back to the theoretical
incorrect, but in practice generally correct code.

The next step will be the isl based code generation. Here we will derive
automatically correct types.

Modified:
    polly/trunk/lib/CodeGen/Cloog.cpp

Modified: polly/trunk/lib/CodeGen/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Cloog.cpp?rev=158015&r1=158014&r2=158015&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Cloog.cpp (original)
+++ polly/trunk/lib/CodeGen/Cloog.cpp Tue Jun  5 14:31:08 2012
@@ -185,7 +185,22 @@
 }
 
 CloogInput *Cloog::buildCloogInput() {
-  CloogDomain *Context = cloog_domain_from_isl_set(S->getContext());
+  // XXX: We do not copy the context of the scop, but use an unconstrained
+  //      context. This 'hack' is necessary as the context may contain bounds
+  //      on parameters such as [n] -> {:0 <= n < 2^32}. Those large
+  //      integers will cause CLooG to construct a clast that contains
+  //      expressions that include these large integers. Such expressions can
+  //      possibly not be evaluated correctly with i64 types. The cloog
+  //      based code generation backend, however, can not derive types
+  //      automatically and just assumes i64 types. Hence, it will break or
+  //      generate incorrect code.
+  //      This hack does not remove all possibilities of incorrectly generated
+  //      code, but it is ensures that for most problems the problems do not
+  //      show up. The correct solution, will be to automatically derive the
+  //      minimal types for each expression. This could be added to CLooG and it
+  //      will be available in the isl based code generation.
+  isl_set *EmptyContext = isl_set_universe(S->getParamSpace());
+  CloogDomain *Context = cloog_domain_from_isl_set(EmptyContext);
   CloogUnionDomain *Statements = buildCloogUnionDomain();
 
   isl_set *ScopContext = S->getContext();





More information about the llvm-commits mailing list