graphite.c (add_conditions_to_domain): Add the loops to the dimension of the iteration domain.

2009-01-16  Sebastian Pop  <sebastian.pop@amd.com>
	    Tobias Grosser  <tobi.grosser@amd.com>

	* graphite.c (add_conditions_to_domain): Add the loops to 
	the dimension of the iteration domain.  Do copy the domain
	only when it exists.
	(build_scop_conditions_1): Do not call add_conditions_to_domain.
	(add_conditions_to_constraints): New.
	(can_generate_code_stmt, can_generate_code): Removed.
	(gloog): Do not call can_generate_code.
	(graphite_transform_loops): Call add_conditions_to_constraints
	after building the iteration domain.


Co-Authored-By: Tobias Grosser <tobi.grosser@amd.com>

From-SVN: r143436
This commit is contained in:
Sebastian Pop 2009-01-16 15:18:28 +00:00 committed by Sebastian Pop
parent 56c6a49994
commit 0b040072d6
2 changed files with 40 additions and 71 deletions

View File

@ -1,3 +1,16 @@
2009-01-16 Sebastian Pop <sebastian.pop@amd.com>
Tobias Grosser <tobi.grosser@amd.com>
* graphite.c (add_conditions_to_domain): Add the loops to
the dimension of the iteration domain. Do copy the domain
only when it exists.
(build_scop_conditions_1): Do not call add_conditions_to_domain.
(add_conditions_to_constraints): New.
(can_generate_code_stmt, can_generate_code): Removed.
(gloog): Do not call can_generate_code.
(graphite_transform_loops): Call add_conditions_to_constraints
after building the iteration domain.
2009-01-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/38789

View File

@ -3112,7 +3112,7 @@ add_conditions_to_domain (graphite_bb_p gb)
else
{
nb_rows = 0;
nb_cols = scop_nb_params (scop) + 2;
nb_cols = nb_loops_around_gb (gb) + scop_nb_params (scop) + 2;
}
/* Count number of necessary new rows to add the conditions to the
@ -3161,14 +3161,18 @@ add_conditions_to_domain (graphite_bb_p gb)
CloogMatrix *new_domain;
new_domain = cloog_matrix_alloc (nb_rows + nb_new_rows, nb_cols);
for (i = 0; i < nb_rows; i++)
for (j = 0; j < nb_cols; j++)
value_assign (new_domain->p[i][j], domain->p[i][j]);
if (domain)
{
for (i = 0; i < nb_rows; i++)
for (j = 0; j < nb_cols; j++)
value_assign (new_domain->p[i][j], domain->p[i][j]);
cloog_matrix_free (domain);
}
cloog_matrix_free (domain);
domain = new_domain;
GBB_DOMAIN (gb) = new_domain;
}
}
/* Add the conditions to the new enlarged domain matrix. */
row = nb_rows;
@ -3358,7 +3362,6 @@ build_scop_conditions_1 (VEC (gimple, heap) **conditions,
{
GBB_CONDITIONS (gbb) = VEC_copy (gimple, heap, *conditions);
GBB_CONDITION_CASES (gbb) = VEC_copy (gimple, heap, *cases);
add_conditions_to_domain (gbb);
}
dom = get_dominated_by (CDI_DOMINATORS, bb);
@ -3515,6 +3518,19 @@ build_scop_conditions (scop_p scop)
return res;
}
/* Traverses all the GBBs of the SCOP and add their constraints to the
iteration domains. */
static void
add_conditions_to_constraints (scop_p scop)
{
int i;
graphite_bb_p gbb;
for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gbb); i++)
add_conditions_to_domain (gbb);
}
/* Build the current domain matrix: the loops belonging to the current
SCOP, and that vary for the execution of the current basic block.
Returns false if there is no loop in SCOP. */
@ -4895,64 +4911,6 @@ find_transform (scop_p scop)
return stmt;
}
/* Returns true when it is possible to generate code for this STMT.
For the moment we cannot generate code when Cloog decides to
duplicate a statement, as we do not do a copy, but a move.
USED_BASIC_BLOCKS records the blocks that have already been seen.
We return false if we have to generate code twice for the same
block. */
static bool
can_generate_code_stmt (struct clast_stmt *stmt,
struct pointer_set_t *used_basic_blocks)
{
if (!stmt)
return true;
if (CLAST_STMT_IS_A (stmt, stmt_root))
return can_generate_code_stmt (stmt->next, used_basic_blocks);
if (CLAST_STMT_IS_A (stmt, stmt_user))
{
CloogStatement *cs = ((struct clast_user_stmt *) stmt)->statement;
graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
if (pointer_set_contains (used_basic_blocks, gbb))
return false;
pointer_set_insert (used_basic_blocks, gbb);
return can_generate_code_stmt (stmt->next, used_basic_blocks);
}
if (CLAST_STMT_IS_A (stmt, stmt_for))
return can_generate_code_stmt (((struct clast_for *) stmt)->body,
used_basic_blocks)
&& can_generate_code_stmt (stmt->next, used_basic_blocks);
if (CLAST_STMT_IS_A (stmt, stmt_guard))
return can_generate_code_stmt (((struct clast_guard *) stmt)->then,
used_basic_blocks);
if (CLAST_STMT_IS_A (stmt, stmt_block))
return can_generate_code_stmt (((struct clast_block *) stmt)->body,
used_basic_blocks)
&& can_generate_code_stmt (stmt->next, used_basic_blocks);
return false;
}
/* Returns true when it is possible to generate code for this STMT. */
static bool
can_generate_code (struct clast_stmt *stmt)
{
bool result;
struct pointer_set_t *used_basic_blocks = pointer_set_create ();
result = can_generate_code_stmt (stmt, used_basic_blocks);
pointer_set_destroy (used_basic_blocks);
return result;
}
/* Remove from the CFG the REGION. */
static inline void
@ -5413,12 +5371,6 @@ gloog (scop_p scop, struct clast_stmt *stmt)
loop_p context_loop;
ifsese if_region = NULL;
if (!can_generate_code (stmt))
{
cloog_clast_free (stmt);
return;
}
if_region = move_sese_in_condition (SCOP_REGION (scop));
sese_build_livein_liveouts (SCOP_REGION (scop));
scop_insert_phis_for_liveouts (SCOP_REGION (scop),
@ -6099,8 +6051,10 @@ graphite_transform_loops (void)
build_scop_canonical_schedules (scop);
build_bb_loops (scop);
if (!build_scop_conditions (scop))
continue;
find_scop_parameters (scop);
build_scop_context (scop);
@ -6116,6 +6070,8 @@ graphite_transform_loops (void)
if (!build_scop_iteration_domain (scop))
continue;
add_conditions_to_constraints (scop);
build_scop_data_accesses (scop);
build_scop_dynamic_schedules (scop);