[Bug tree-optimization/37705] [graphite] Fix problems with SCoPs, that contain more than one loop

2008-10-15 Thread grosser at gcc dot gnu dot org


--- Comment #1 from grosser at gcc dot gnu dot org  2008-10-16 05:20 ---
Created an attachment (id=16505)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16505action=view)
Fix loop_affine_expr to remove limit_scops () - This is a HACK looking for
smarter solution

Problem 1:

Scalar evolution functions in loop limits and conditions have to be constant or 
affine to be allowed in a SCoP.
During SCoP detection we check this with:

if (evolution_function_is_invariant_p (scev, n)
|| evolution_function_is_affine_multivariate_p (scev, n));

in loop_affine_expr().
If this expression is true, it is allowed in a SCoP.

But e.g. the constant expr p_1 * p_2 is allow in a SCoP, but we can not
represent it using the polyhedron model.

The matrix would be

p_1  p_2  Const
xyz

with x*p_1 + y*p_2 + z

There is no way to represent p_1 * p_2, so we fail in scan_tree_for_params
trying to generate the matrix.

There are two solutions:

1. This expression is representable, if we introduce a new parameter p_3 = p_1
* p_2 and calculate it before the SCoP.

2. We detect this cases and do not allow them in any SCoP.

I would like to start with solution two. Later on we can implement solution
one.

I attached a patch, that simply copies scan_tree_for_params() and returns true,
if a expression can be handled by scan_tree_for_params() otherwise false.

This works on polyhedron using -fgraphite, but seems not to be the cleanest
solution. I would prefer to keep

if (evolution_function_is_invariant_p (scev, n)
|| evolution_function_is_affine_multivariate_p (scev, n));

and add only
 (no_multiplication_in_parameters (scev)).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37705



[Bug tree-optimization/37705] [graphite] Fix problems with SCoPs, that contain more than one loop

2008-10-01 Thread grosser at gcc dot gnu dot org


-- 

grosser at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Priority|P3  |P4
   Last reconfirmed|-00-00 00:00:00 |2008-10-01 17:16:46
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37705