From 2fc3c9a59b046f462fe13232768f5efc023928ea Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Thu, 30 Apr 2015 05:42:54 +0000 Subject: [PATCH] tree-vectorizer.c (set_uid_loop_bbs): New. 2015-04-29 Aditya Kumar * tree-vectorizer.c (set_uid_loop_bbs): New. Factored out of vectorize_loops. (vectorize_loops): Use it. From-SVN: r222610 --- gcc/ChangeLog | 6 ++++ gcc/tree-vectorizer.c | 65 ++++++++++++++++++++++--------------------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 071c12db71a..854ae4161a9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-04-29 Aditya Kumar + + * tree-vectorizer.c (set_uid_loop_bbs): New. Factored out of + vectorize_loops. + (vectorize_loops): Use it. + 2015-04-29 Jan Hubicka * ipa-devirt.c (odr_subtypes_equivalent_p): Compare TYPE_NAME only diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 313e936b423..e216114fb60 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -398,6 +398,39 @@ fold_loop_vectorized_call (gimple g, tree value) update_stmt (use_stmt); } } +/* Set the uids of all the statements in basic blocks inside loop + represented by LOOP_VINFO. LOOP_VECTORIZED_CALL is the internal + call guarding the loop which has been if converted. */ +static void +set_uid_loop_bbs (loop_vec_info loop_vinfo, gimple loop_vectorized_call) +{ + tree arg = gimple_call_arg (loop_vectorized_call, 1); + basic_block *bbs; + unsigned int i; + struct loop *scalar_loop = get_loop (cfun, tree_to_shwi (arg)); + + LOOP_VINFO_SCALAR_LOOP (loop_vinfo) = scalar_loop; + gcc_checking_assert (vect_loop_vectorized_call + (LOOP_VINFO_SCALAR_LOOP (loop_vinfo)) + == loop_vectorized_call); + bbs = get_loop_body (scalar_loop); + for (i = 0; i < scalar_loop->num_nodes; i++) + { + basic_block bb = bbs[i]; + gimple_stmt_iterator gsi; + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple phi = gsi_stmt (gsi); + gimple_set_uid (phi, 0); + } + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + gimple_set_uid (stmt, 0); + } + } + free (bbs); +} /* Function vectorize_loops. @@ -461,37 +494,7 @@ vectorize_loops (void) gimple loop_vectorized_call = vect_loop_vectorized_call (loop); if (loop_vectorized_call) - { - tree arg = gimple_call_arg (loop_vectorized_call, 1); - basic_block *bbs; - unsigned int i; - struct loop *scalar_loop = get_loop (cfun, tree_to_shwi (arg)); - - LOOP_VINFO_SCALAR_LOOP (loop_vinfo) = scalar_loop; - gcc_checking_assert (vect_loop_vectorized_call - (LOOP_VINFO_SCALAR_LOOP (loop_vinfo)) - == loop_vectorized_call); - bbs = get_loop_body (scalar_loop); - for (i = 0; i < scalar_loop->num_nodes; i++) - { - basic_block bb = bbs[i]; - gimple_stmt_iterator gsi; - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); - gsi_next (&gsi)) - { - gimple phi = gsi_stmt (gsi); - gimple_set_uid (phi, 0); - } - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); - gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - gimple_set_uid (stmt, 0); - } - } - free (bbs); - } - + set_uid_loop_bbs (loop_vinfo, loop_vectorized_call); if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION && dump_enabled_p ()) dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,