[Bug tree-optimization/77318] [7 regression] FAIL: gfortran.dg/graphite/pr68279.f90 -O (internal compiler error)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 31 10:59:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77318
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, so the issue is we have a region that is inside of loop 1 but does not
fully cover it and in
/* Returns a linear expression for tree T evaluated in PBB. */
static isl_pw_aff *
create_pw_aff_from_tree (poly_bb_p pbb, tree t)
{
scop_p scop = PBB_SCOP (pbb);
t = scalar_evolution_in_region (scop->scop_info->region, pbb_loop (pbb), t);
when analyzing _62 from a condition on a block inside the region (the blocks
loop father is loop 1) pbb_loop returns loop 3 (pbb->black_box->bb is its
loop header).
_62 is defined inside the region, but then
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));
here loop is loop 3 and thus we call analyze_scalar_evolution with bogus input
which just returns t, instantiate_scev then instantiates it to
(integer(kind=8)) (integer(kind=4)) {(unsigned int) pretmp_123 + 4294967295, +,
1}_1 but this has an evolution in a loop that is not in the region and boom.
Eventually that pbb is bogus from the start or rather that we are using pbb
when adding dominating conditions(?).
Index: gcc/graphite-sese-to-poly.c
===================================================================
--- gcc/graphite-sese-to-poly.c (revision 245052)
+++ gcc/graphite-sese-to-poly.c (working copy)
@@ -436,11 +436,11 @@ extract_affine (scop_p s, tree e, __isl_
/* Returns a linear expression for tree T evaluated in PBB. */
static isl_pw_aff *
-create_pw_aff_from_tree (poly_bb_p pbb, tree t)
+create_pw_aff_from_tree (poly_bb_p pbb, loop_p loop, tree t)
{
scop_p scop = PBB_SCOP (pbb);
- t = scalar_evolution_in_region (scop->scop_info->region, pbb_loop (pbb), t);
+ t = scalar_evolution_in_region (scop->scop_info->region, loop, t);
gcc_assert (!chrec_contains_undetermined (t));
gcc_assert (!automatically_generated_chrec_p (t));
@@ -455,8 +455,9 @@ create_pw_aff_from_tree (poly_bb_p pbb,
static void
add_condition_to_pbb (poly_bb_p pbb, gcond *stmt, enum tree_code code)
{
- isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, gimple_cond_lhs (stmt));
- isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, gimple_cond_rhs (stmt));
+ loop_p loop = gimple_bb (stmt)->loop_father;
+ isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, loop, gimple_cond_lhs
(stmt));
+ isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, loop, gimple_cond_rhs
(stmt));
isl_set *cond;
switch (code)
fixes that but then we ICE in
#1 0x00000000019bfc12 in extract_affine (s=0x2ab42a0,
e=<ssa_name 0x7ffff6aa0900>, space=0x2ae7790)
at /space/rguenther/src/svn/gcc-7-branch/gcc/graphite-sese-to-poly.c:409
408 case SSA_NAME:
409 gcc_assert (-1 != parameter_index_in_region_1 (e, s->scop_info)
410 || !invariant_in_sese_p_rec (e, s->scop_info->region,
NULL));
because the SSA name failed to register as parameter(?) - it is actually
defined inside! But we run into
tree
scalar_evolution_in_region (const sese_l ®ion, loop_p loop, tree t)
{
...
if (invariant_in_sese_p_rec (t, region, &has_vdefs))
return t;
which looks correct -- but it seems that extract_affine assumes we
"instantiate" an expression up to the regions params...
So maybe that assert is just another bogus one or scalar_evolution_in_region
is bogus (instantiating before the region entry returns a chrec with an
evolution in a loop not inside the region again...).
Well. Doing
Index: gcc/graphite-sese-to-poly.c
===================================================================
--- gcc/graphite-sese-to-poly.c (revision 245052)
+++ gcc/graphite-sese-to-poly.c (working copy)
@@ -407,7 +407,7 @@ extract_affine (scop_p s, tree e, __isl_
case SSA_NAME:
gcc_assert (-1 != parameter_index_in_region_1 (e, s->scop_info)
- || !invariant_in_sese_p_rec (e, s->scop_info->region, NULL));
+ || defined_in_sese_p (e, s->scop_info->region));
res = extract_affine_name (s, e, space);
break;
fixes the testcase and still passes graphite.exp for all languages w/ {,-m32}.
More information about the Gcc-bugs
mailing list