From 371cc683371bedb0e53ebcee0c0e89604a1e74b1 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 10 Jun 2020 18:07:37 +0200 Subject: [PATCH] avoid stmt-info allocation for debug stmts The following avoids allocating stmt info structs for debug stmts. 2020-06-10 Richard Biener * tree-vect-loop.c (vect_determine_vectorization_factor): Skip debug stmts. (_loop_vec_info::_loop_vec_info): Likewise. (vect_update_vf_for_slp): Likewise. (vect_analyze_loop_operations): Likewise. (update_epilogue_loop_vinfo): Likewise. * tree-vect-patterns.c (vect_determine_precisions): Likewise. (vect_pattern_recog): Likewise. * tree-vect-slp.c (vect_detect_hybrid_slp): Likewise. (_bb_vec_info::_bb_vec_info): Likewise. * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise. --- gcc/tree-vect-loop.c | 13 ++++++++++++- gcc/tree-vect-patterns.c | 9 ++++++--- gcc/tree-vect-slp.c | 4 ++++ gcc/tree-vect-stmts.c | 2 ++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index f0b33258ac5..53def19a4fb 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -342,6 +342,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { + if (is_gimple_debug (gsi_stmt (si))) + continue; stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si)); opt_result res = vect_determine_vf_for_stmt (loop_vinfo, @@ -847,6 +849,8 @@ _loop_vec_info::_loop_vec_info (class loop *loop_in, vec_info_shared *shared) { gimple *stmt = gsi_stmt (si); gimple_set_uid (stmt, 0); + if (is_gimple_debug (stmt)) + continue; add_stmt (stmt); /* If .GOMP_SIMD_LANE call for the current loop has 3 arguments, the third argument is the #pragma omp simd if (x) condition, when 0, @@ -1393,6 +1397,8 @@ vect_update_vf_for_slp (loop_vec_info loop_vinfo) for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { + if (is_gimple_debug (gsi_stmt (si))) + continue; stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si)); stmt_info = vect_stmt_to_vectorize (stmt_info); if ((STMT_VINFO_RELEVANT_P (stmt_info) @@ -1584,7 +1590,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) gsi_next (&si)) { gimple *stmt = gsi_stmt (si); - if (!gimple_clobber_p (stmt)) + if (!gimple_clobber_p (stmt) + && !is_gimple_debug (stmt)) { opt_result res = vect_analyze_stmt (loop_vinfo, @@ -2345,6 +2352,8 @@ again: for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { + if (is_gimple_debug (gsi_stmt (si))) + continue; stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si)); STMT_SLP_TYPE (stmt_info) = loop_vect; if (STMT_VINFO_IN_PATTERN_P (stmt_info)) @@ -8373,6 +8382,8 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance) !gsi_end_p (epilogue_gsi); gsi_next (&epilogue_gsi)) { new_stmt = gsi_stmt (epilogue_gsi); + if (is_gimple_debug (new_stmt)) + continue; gcc_assert (gimple_uid (new_stmt) > 0); stmt_vinfo diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 930f47e0742..636ad59c001 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -5112,8 +5112,9 @@ vect_determine_precisions (vec_info *vinfo) basic_block bb = bbs[nbbs - i - 1]; for (gimple_stmt_iterator si = gsi_last_bb (bb); !gsi_end_p (si); gsi_prev (&si)) - vect_determine_stmt_precisions - (vinfo, vinfo->lookup_stmt (gsi_stmt (si))); + if (!is_gimple_debug (gsi_stmt (si))) + vect_determine_stmt_precisions + (vinfo, vinfo->lookup_stmt (gsi_stmt (si))); } } else @@ -5478,6 +5479,8 @@ vect_pattern_recog (vec_info *vinfo) basic_block bb = bbs[i]; for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { + if (is_gimple_debug (gsi_stmt (si))) + continue; stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi_stmt (si)); /* Scan over all generic vect_recog_xxx_pattern functions. */ for (j = 0; j < NUM_PATTERNS; j++) @@ -5494,7 +5497,7 @@ vect_pattern_recog (vec_info *vinfo) { gimple *stmt = gsi_stmt (si); stmt_vec_info stmt_info = bb_vinfo->lookup_stmt (stmt); - if (stmt_info && !STMT_VINFO_VECTORIZABLE (stmt_info)) + if (!stmt_info || !STMT_VINFO_VECTORIZABLE (stmt_info)) continue; /* Scan over all generic vect_recog_xxx_pattern functions. */ diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 866ce8d3717..303410c2fc4 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2500,6 +2500,8 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo) gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); + if (is_gimple_debug (stmt)) + continue; stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (stmt); if (STMT_VINFO_IN_PATTERN_P (stmt_info)) { @@ -2559,6 +2561,8 @@ _bb_vec_info::_bb_vec_info (gimple_stmt_iterator region_begin_in, { gimple *stmt = gsi_stmt (gsi); gimple_set_uid (stmt, 0); + if (is_gimple_debug (stmt)) + continue; add_stmt (stmt); } diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 686eb389f0c..72f0e8061f5 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -636,6 +636,8 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo, bool *fatal) } for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { + if (is_gimple_debug (gsi_stmt (si))) + continue; stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si)); if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, -- 2.30.2