avoid stmt-info allocation for debug stmts
authorRichard Biener <rguenther@suse.de>
Wed, 10 Jun 2020 16:07:37 +0000 (18:07 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 10 Jun 2020 16:08:29 +0000 (18:08 +0200)
The following avoids allocating stmt info structs for debug stmts.

2020-06-10  Richard Biener  <rguenther@suse.de>

* 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
gcc/tree-vect-patterns.c
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c

index f0b33258ac54b5d16399942cc33ff59b2e04056c..53def19a4fb5e941e727c2f0cb28d15b6966f662 100644 (file)
@@ -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
index 930f47e0742a9a1177d2a6440134a728a960abd2..636ad59c00169d13b294553937f2eb47b23df3d6 100644 (file)
@@ -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.  */
index 866ce8d37172791d37b5057afa1215df6a1a5336..303410c2fc4bb274ef4fd63c4821730df66f4934 100644 (file)
@@ -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);
     }
 
index 686eb389f0c98b717712a4c25435ca9f8b05877d..72f0e8061f5fb2bba72ac811d0a2f2719cf62b14 100644 (file)
@@ -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,