[Bug tree-optimization/79302] [6/7 Regression] ICE in add_loop_constraints, at graphite-sese-to-poly.c:933 building 445.gobmk
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 31 13:34:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79302
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
But it smells similar to PR77318.
gcc_assert (!chrec_contains_undetermined (nb_iters));
nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
gcc_assert (!chrec_contains_undetermined (nb_iters));
nb_iters is (unsigned int) _2 + 4294967295, defined outside of loop,
loops outer loop is not fully contained within the region.
scalar_evolution_in_region goes
if (TREE_CODE (t) != SSA_NAME
|| loop_in_sese_p (loop, region))
/* FIXME: we would need instantiate SCEV to work on a region, and be more
flexible wrt. memory loads that may be invariant in the region. */
return instantiate_scev (before, loop,
analyze_scalar_evolution (loop, t));
where analyze_scalar_evolution just does nothing (obviously) but
instantiate_scev returns scev_not_known because in 'before' we have
_2 = middle_39 - bottom_30 and that's not analyzable (but graphite
expects instantiation to stop there, evaluating to this symbolically).
But we do
static tree
instantiate_scev_name (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
bool *fold_conversions,
int size_expr)
{
...
/* If the analysis yields a parametric chrec, instantiate the
result again. */
res = analyze_scalar_evolution (def_loop, chrec);
and that fails and we run in circles via
else if (res != chrec_dont_know)
{
if (inner_loop
&& def_bb->loop_father != inner_loop
&& !flow_loop_nested_p (def_bb->loop_father, inner_loop))
/* ??? We could try to compute the overall effect of the loop here.
*/
res = chrec_dont_know;
else
res = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, res,
fold_conversions, size_expr);
with the same SSA name again and again until we give up due to the recursion
limit. So the expectation of GRAPHITE is sth like
Index: gcc/tree-scalar-evolution.c
===================================================================
--- gcc/tree-scalar-evolution.c (revision 245058)
+++ gcc/tree-scalar-evolution.c (working copy)
@@ -280,6 +280,7 @@ along with GCC; see the file COPYING3.
#include "params.h"
#include "tree-ssa-propagate.h"
#include "gimple-fold.h"
+#include "cfgexpand.h"
static tree analyze_scalar_evolution_1 (struct loop *, tree, tree);
static tree analyze_scalar_evolution_for_address_of (struct loop *loop,
@@ -2460,9 +2461,14 @@ instantiate_scev_name (basic_block insta
/* ??? We could try to compute the overall effect of the loop here.
*/
res = chrec_dont_know;
else
- res = instantiate_scev_r (instantiate_below, evolution_loop,
- inner_loop, res,
- fold_conversions, size_expr);
+ {
+ if (res == chrec
+ && is_gimple_assign (SSA_NAME_DEF_STMT (res)))
+ res = gimple_assign_rhs_to_tree (SSA_NAME_DEF_STMT (res));
+ res = instantiate_scev_r (instantiate_below, evolution_loop,
+ inner_loop, res,
+ fold_conversions, size_expr);
+ }
}
/* Store the correct value to the cache. */
which fixes the ICE. But we can probably simply deal with this case in
add_loop_constraints with
Index: gcc/graphite-sese-to-poly.c
===================================================================
--- gcc/graphite-sese-to-poly.c (revision 245058)
+++ gcc/graphite-sese-to-poly.c (working copy)
@@ -930,7 +931,11 @@ add_loop_constraints (scop_p scop, __isl
/* loop_i <= expr_nb_iters */
gcc_assert (!chrec_contains_undetermined (nb_iters));
nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
- gcc_assert (!chrec_contains_undetermined (nb_iters));
+ if (chrec_contains_undetermined (nb_iters))
+ {
+ isl_space_free (space);
+ return domain;
+ }
isl_pw_aff *aff_nb_iters = extract_affine (scop, nb_iters,
isl_space_copy (space));
More information about the Gcc-bugs
mailing list