[Bug middle-end/38492] [graphite] segfaulting code when compiled with -fgraphite -fgraphite-identity
jsjodin at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Dec 18 19:40:00 GMT 2008
------- Comment #6 from jsjodin at gcc dot gnu dot org 2008-12-18 19:39 -------
> This still fails here:
>
> gfortran -v -O2 -g -ffree-form -fgraphite -fgraphite-identity -cpp -D__FFTSG
> PR38492.f90
>
I looked into this failure. It fails because the number of iterations cannot be
computed (chrec_unknown) when the loop domain is translated, and is ignored by
scan_tree_for_params. In general it can be dangerous to throw away
chrec_unknown, because it may code that we must generate.
The patch will prevent the scop from being transformed if the number of
iterations cannot be analyzed, and it will no longer ignore chrec_unknown. I
will run some more tests to make sure it does not break anything else. The
patch is below:
Index: graphite.c
===================================================================
--- graphite.c (revision 142764)
+++ graphite.c (working copy)
@@ -2356,6 +2356,7 @@ graphite_loop_normal_form (loop_p loop)
tree nit;
gimple_seq stmts;
edge exit = single_dom_exit (loop);
+ tree iv = NULL_TREE;
if (!number_of_iterations_exit (loop, exit, &niter, false))
gcc_unreachable ();
@@ -2369,7 +2370,14 @@ graphite_loop_normal_form (loop_p loop)
if (nb_reductions_in_loop (loop) > 0)
return NULL_TREE;
- return canonicalize_loop_ivs (loop, NULL, nit);
+ iv = canonicalize_loop_ivs (loop, NULL, nit);
+
+ nit = number_of_latch_executions (loop);
+ nit = analyze_scalar_evolution (loop, nit);
+ if (nit == chrec_dont_know)
+ return NULL_TREE;
+
+ return iv;
}
/* Record LOOP as occuring in SCOP. Returns true when the operation
@@ -2602,7 +2610,7 @@ scan_tree_for_params (scop_p s, tree e,
int cst_col, param_col;
if (e == chrec_dont_know)
- return;
+ gcc_unreachable ();
switch (TREE_CODE (e))
{
--
jsjodin at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsjodin at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38492
More information about the Gcc-bugs
mailing list