Mercurial > hg > CbC > CbC_gcc
diff gcc/graphite.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/gcc/graphite.c Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/graphite.c Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* Gimple Represented as Polyhedra. - Copyright (C) 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. Contributed by Sebastian Pop <sebastian.pop@inria.fr>. This file is part of GCC. @@ -38,6 +38,7 @@ #include "tree-pass.h" #include "params.h" #include "pretty-print.h" +#include "cfganal.h" #ifdef HAVE_isl #include "cfghooks.h" @@ -226,15 +227,11 @@ /* Transforms LOOP to the canonical loop closed SSA form. */ static void -canonicalize_loop_closed_ssa (loop_p loop) +canonicalize_loop_closed_ssa (loop_p loop, edge e) { - edge e = single_exit (loop); basic_block bb; gphi_iterator psi; - if (!e || (e->flags & EDGE_COMPLEX)) - return; - bb = e->dest; /* Make the loop-close PHI node BB contain only PHIs and have a @@ -313,14 +310,38 @@ other statements. - there exist only one phi node per definition in the loop. + + In addition to that we also make sure that loop exit edges are + first in the successor edge vector. This is to make RPO order + as computed by pre_and_rev_post_order_compute be consistent with + what initial schedule generation expects. */ static void -canonicalize_loop_closed_ssa_form (void) +canonicalize_loop_form (void) { loop_p loop; FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) - canonicalize_loop_closed_ssa (loop); + { + edge e = single_exit (loop); + if (!e || (e->flags & (EDGE_COMPLEX|EDGE_FAKE))) + continue; + + canonicalize_loop_closed_ssa (loop, e); + + /* If the exit is not first in the edge vector make it so. */ + if (e != EDGE_SUCC (e->src, 0)) + { + unsigned ei; + for (ei = 0; EDGE_SUCC (e->src, ei) != e; ++ei) + ; + std::swap (EDGE_SUCC (e->src, ei), EDGE_SUCC (e->src, 0)); + } + } + + /* We can end up releasing duplicate exit PHIs and also introduce + additional copies so the cached information isn't correct anymore. */ + scev_reset (); checking_verify_loop_closed_ssa (true); } @@ -346,12 +367,16 @@ calculate_dominance_info (CDI_DOMINATORS); + /* We rely on post-dominators during merging of SESE regions so those + have to be meaningful. */ + connect_infinite_loops_to_exit (); + ctx = isl_ctx_alloc (); isl_options_set_on_error (ctx, ISL_ON_ERROR_ABORT); the_isl_ctx = ctx; sort_sibling_loops (cfun); - canonicalize_loop_closed_ssa_form (); + canonicalize_loop_form (); /* Print the loop structure. */ if (dump_file && (dump_flags & TDF_DETAILS)) @@ -364,6 +389,10 @@ build_scops (&scops); free_dominance_info (CDI_POST_DOMINATORS); + /* Remove the fake exits before transform given they are not reflected + in loop structures we end up verifying. */ + remove_fake_exit_edges (); + if (dump_file && (dump_flags & TDF_DETAILS)) { print_graphite_statistics (dump_file, scops); @@ -383,7 +412,7 @@ changed = true; if (graphite_regenerate_ast_isl (scop)) { - location_t loc = find_loop_location + dump_user_location_t loc = find_loop_location (scops[i]->scop_info->region.entry->dest->loop_father); dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, "loop nest optimized\n"); @@ -424,7 +453,6 @@ release_recorded_exits (cfun); tree_estimate_probability (false); } - } #else /* If isl is not available: #ifndef HAVE_isl. */