aboutsummaryrefslogtreecommitdiff
path: root/gcc/sese.c
diff options
context:
space:
mode:
authorSebastian Pop <seb@napoca>2010-02-11 19:42:38 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-02-11 19:42:38 +0000
commita1954f72c64181e9cd63945c12776e168f166bc3 (patch)
tree9a93f6270813899e2fca5101fe3e5ca955c10cee /gcc/sese.c
parent01e64c3dc777ec3515ca89cb279410edab2fc5c2 (diff)
downloadgcc-a1954f72c64181e9cd63945c12776e168f166bc3.zip
gcc-a1954f72c64181e9cd63945c12776e168f166bc3.tar.gz
gcc-a1954f72c64181e9cd63945c12776e168f166bc3.tar.bz2
re PR tree-optimization/42771 ([graphite] ICE: in graphite_loop_normal_form, at graphite-sese-to-poly.c (2))
Fix PR42771. 2010-02-10 Sebastian Pop <seb@napoca> PR middle-end/42771 * graphite-clast-to-gimple.c (gloog): Call rename_sese_parameters. * graphite-clast-to-gimple.h (gloog): Update declaration. * graphite-poly.c (new_scop): Clear POLY_SCOP_P. * graphite-poly.h (struct poly_bb): Add missing comments. (struct scop): Add poly_scop_p field. (POLY_SCOP_P): New. * graphite-sese-to-poly.c (build_poly_scop): Set POLY_SCOP_P. * graphite.c (graphite_transform_loops): Build the polyhedral representation for each scop before code generation. * sese.c (rename_variables_in_operand): Removed. (rename_variables_in_expr): Return the renamed expression. (rename_sese_parameters): New. * sese.h (rename_sese_parameters): Declared. * gcc.dg/graphite/pr42771.c: New. From-SVN: r156711
Diffstat (limited to 'gcc/sese.c')
-rw-r--r--gcc/sese.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/gcc/sese.c b/gcc/sese.c
index f959bdb..6fb4065 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -526,49 +526,31 @@ set_rename (htab_t map, tree old_name, tree expr)
*slot = new_rename_map_elt (old_name, expr);
}
-static void rename_variables_in_expr (htab_t, tree);
-
-/* Renames the operand OP of expression T following the tuples
- (OLD_NAME, EXPR) in RENAME_MAP. */
-
-static void
-rename_variables_in_operand (htab_t rename_map, tree t, int op)
-{
- tree operand = TREE_OPERAND (t, op);
-
- if (TREE_CODE (operand) == SSA_NAME)
- {
- tree new_name = get_rename (rename_map, operand);
-
- if (new_name != operand)
- TREE_OPERAND (t, op) = new_name;
- }
- else
- rename_variables_in_expr (rename_map, operand);
-}
-
/* Renames the expression T following the tuples (OLD_NAME, EXPR) in
- RENAME_MAP. */
+ the rename map M. Returns the expression T after renaming. */
-static void
-rename_variables_in_expr (htab_t rename_map, tree t)
+static tree
+rename_variables_in_expr (htab_t m, tree t)
{
if (!t)
- return;
+ return t;
+
+ if (TREE_CODE (t) == SSA_NAME)
+ return get_rename (m, t);
switch (TREE_CODE_LENGTH (TREE_CODE (t)))
{
case 3:
- rename_variables_in_operand (rename_map, t, 2);
+ TREE_OPERAND (t, 2) = rename_variables_in_expr (m, TREE_OPERAND (t, 2));
case 2:
- rename_variables_in_operand (rename_map, t, 1);
+ TREE_OPERAND (t, 1) = rename_variables_in_expr (m, TREE_OPERAND (t, 1));
case 1:
- rename_variables_in_operand (rename_map, t, 0);
+ TREE_OPERAND (t, 0) = rename_variables_in_expr (m, TREE_OPERAND (t, 0));
default:
- return;
+ return t;
}
}
@@ -582,9 +564,22 @@ rename_nb_iterations (htab_t rename_map)
struct loop *loop;
FOR_EACH_LOOP (li, loop, 0)
- {
- rename_variables_in_expr (rename_map, loop->nb_iterations);
- }
+ loop->nb_iterations = rename_variables_in_expr (rename_map,
+ loop->nb_iterations);
+}
+
+/* Renames all the parameters of SESE following the tuples (OLD_NAME,
+ EXPR) in RENAME_MAP. */
+
+void
+rename_sese_parameters (htab_t rename_map, sese region)
+{
+ int i;
+ tree p;
+
+ for (i = 0; VEC_iterate (tree, SESE_PARAMS (region), i, p); i++)
+ VEC_replace (tree, SESE_PARAMS (region), i,
+ rename_variables_in_expr (rename_map, p));
}
/* Adjusts the phi nodes in the block BB for variables defined in