From c80a540338e5809cdf058b13e23e30585219a0fa Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Wed, 31 Mar 2010 18:37:13 +0000 Subject: canonicalize_loop_ivs should add the IV bump in loop->header. 2010-03-16 Sebastian Pop * graphite-sese-to-poly.c (graphite_loop_normal_form): Add the IV bump in loop->header. * tree-flow.h (canonicalize_loop_ivs): Updated declaration. * tree-parloops.c (gen_parallel_loop): Add the IV bump in loop->latch. * tree-ssa-loop-manip.c (canonicalize_loop_ivs): Add a new parameter to switch between adding the IV bump in loop->latch or in loop->header. From-SVN: r157885 --- gcc/tree-ssa-loop-manip.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gcc/tree-ssa-loop-manip.c') diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 7c54c87e74f..7818f5b4f1a 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1181,11 +1181,13 @@ rewrite_all_phi_nodes_with_iv (loop_p loop, tree main_iv) compared with *NIT. When the IV type precision has to be larger than *NIT type precision, *NIT is converted to the larger type, the conversion code is inserted before the loop, and *NIT is updated to - the new definition. The induction variable is incremented in the - loop latch. Return the induction variable that was created. */ + the new definition. When BUMP_IN_LATCH is true, the induction + variable is incremented in the loop latch, otherwise it is + incremented in the loop header. Return the induction variable that + was created. */ tree -canonicalize_loop_ivs (struct loop *loop, tree *nit) +canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch) { unsigned precision = TYPE_PRECISION (TREE_TYPE (*nit)); unsigned original_precision = precision; @@ -1215,9 +1217,9 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit) gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts); } - gsi = gsi_last_bb (loop->latch); + gsi = gsi_last_bb (bump_in_latch ? loop->latch : loop->header); create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE, - loop, &gsi, true, &var_before, NULL); + loop, &gsi, bump_in_latch, &var_before, NULL); rewrite_all_phi_nodes_with_iv (loop, var_before); -- cgit v1.2.1