diff options
author | Richard Biener <rguenther@suse.de> | 2017-10-02 07:32:52 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-10-02 07:32:52 +0000 |
commit | 0389d86c4e252df643f9c3539e5a114add56ec7f (patch) | |
tree | 83af0087c3c1be8a0a44f85b0ac7b545e5279af2 /gcc/graphite-sese-to-poly.c | |
parent | 623c6df543b5cb025815e6a79ded86f889f4a4b1 (diff) | |
download | gcc-0389d86c4e252df643f9c3539e5a114add56ec7f.zip gcc-0389d86c4e252df643f9c3539e5a114add56ec7f.tar.gz gcc-0389d86c4e252df643f9c3539e5a114add56ec7f.tar.bz2 |
re PR tree-optimization/82355 (ICE in outermost_loop_in_sese, at sese.c:301)
2017-10-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/82355
* graphite-isl-ast-to-gimple.c (build_iv_mapping): Also build
a mapping for the enclosing loop but avoid generating one for
the loop tree root.
(copy_bb_and_scalar_dependences): Remove premature codegen
error on PHIs in blocks duplicated into multiple places.
* graphite-scop-detection.c
(scop_detection::stmt_has_simple_data_refs_p): For a loop not
in the region use it as loop and nest to analyze the DR in.
(try_generate_gimple_bb): Likewise.
* graphite-sese-to-poly.c (extract_affine_chrec): Adjust.
(add_loop_constraints): For blocks in a loop not in the region
create a dimension with a single iteration.
* sese.h (gbb_loop_at_index): Remove assert.
* gcc.dg/graphite/fuse-1.c: Adjust.
* gcc.dg/graphite/fuse-2.c: Likewise.
* gcc.dg/graphite/pr82355.c: New testcase.
From-SVN: r253336
Diffstat (limited to 'gcc/graphite-sese-to-poly.c')
-rw-r--r-- | gcc/graphite-sese-to-poly.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 087a44a..8611e86 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -86,7 +86,7 @@ extract_affine_chrec (scop_p s, tree e, __isl_take isl_space *space) isl_pw_aff *lhs = extract_affine (s, CHREC_LEFT (e), isl_space_copy (space)); isl_pw_aff *rhs = extract_affine (s, CHREC_RIGHT (e), isl_space_copy (space)); isl_local_space *ls = isl_local_space_from_space (space); - unsigned pos = sese_loop_depth (s->scop_info->region, get_chrec_loop (e)) - 1; + unsigned pos = sese_loop_depth (s->scop_info->region, get_chrec_loop (e)); isl_aff *loop = isl_aff_set_coefficient_si (isl_aff_zero_on_domain (ls), isl_dim_in, pos, 1); isl_pw_aff *l = isl_pw_aff_from_aff (loop); @@ -756,10 +756,10 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, return domain; const sese_l ®ion = scop->scop_info->region; if (!loop_in_sese_p (loop, region)) - return domain; - - /* Recursion all the way up to the context loop. */ - domain = add_loop_constraints (scop, domain, loop_outer (loop), context); + ; + else + /* Recursion all the way up to the context loop. */ + domain = add_loop_constraints (scop, domain, loop_outer (loop), context); /* Then, build constraints over the loop in post-order: outer to inner. */ @@ -770,6 +770,21 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, domain = add_iter_domain_dimension (domain, loop, scop); isl_space *space = isl_set_get_space (domain); + if (!loop_in_sese_p (loop, region)) + { + /* 0 == loop_i */ + isl_local_space *ls = isl_local_space_from_space (space); + isl_constraint *c = isl_equality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, 1); + if (dump_file) + { + fprintf (dump_file, "[sese-to-poly] adding constraint to the domain: "); + print_isl_constraint (dump_file, c); + } + domain = isl_set_add_constraint (domain, c); + return domain; + } + /* 0 <= loop_i */ isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); isl_constraint *c = isl_inequality_alloc (ls); |