This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove location wrapping in tree-vectorizer.h


tree-vectorizer.h wraps all of source_location, LOCATION_LINE,
LOCATION_FILE and UNKNOWN_LOCATION.

The following gets rid of that pointless excercise.

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

2013-11-21  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (LOC, UNKNOWN_LOC, EXPR_LOC, LOC_FILE,
	LOC_LINE): Remove wrappers and fix all users.
	(struct _loop_vec_info): Remove loop_line_number member.
	(LOOP_VINFO_LOC): Remove.
	* tree-parloops.c, tree-vect-loop-manip.c, tree-vect-slp.c,
	tree-vectorizer.c: Fix users of LOC, UNKNOWN_LOC, EXPR_LOC, LOC_FILE
	and LOC_LINE.

Index: trunk/gcc/tree-parloops.c
===================================================================
*** trunk.orig/gcc/tree-parloops.c	2013-11-19 16:21:01.000000000 +0100
--- trunk/gcc/tree-parloops.c	2013-11-21 10:40:02.260898174 +0100
*************** parallelize_loops (void)
*** 2145,2151 ****
    reduction_info_table_type reduction_list;
    struct obstack parloop_obstack;
    HOST_WIDE_INT estimated;
!   LOC loop_loc;
  
    /* Do not parallelize loops in the functions created by parallelization.  */
    if (parallelized_function_p (cfun->decl))
--- 2145,2151 ----
    reduction_info_table_type reduction_list;
    struct obstack parloop_obstack;
    HOST_WIDE_INT estimated;
!   source_location loop_loc;
  
    /* Do not parallelize loops in the functions created by parallelization.  */
    if (parallelized_function_p (cfun->decl))
*************** parallelize_loops (void)
*** 2225,2233 ****
  	else
  	  fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index);
  	loop_loc = find_loop_location (loop);
! 	if (loop_loc != UNKNOWN_LOC)
  	  fprintf (dump_file, "\nloop at %s:%d: ",
! 		   LOC_FILE (loop_loc), LOC_LINE (loop_loc));
        }
        gen_parallel_loop (loop, reduction_list,
  			 n_threads, &niter_desc);
--- 2225,2233 ----
  	else
  	  fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index);
  	loop_loc = find_loop_location (loop);
! 	if (loop_loc != UNKNOWN_LOCATION)
  	  fprintf (dump_file, "\nloop at %s:%d: ",
! 		   LOCATION_FILE (loop_loc), LOCATION_LINE (loop_loc));
        }
        gen_parallel_loop (loop, reduction_list,
  			 n_threads, &niter_desc);
Index: trunk/gcc/tree-vect-loop-manip.c
===================================================================
*** trunk.orig/gcc/tree-vect-loop-manip.c	2013-11-21 10:25:01.000000000 +0100
--- trunk/gcc/tree-vect-loop-manip.c	2013-11-21 10:52:58.994743603 +0100
*************** slpeel_make_loop_iterate_ntimes (struct
*** 661,667 ****
    bool insert_after;
    tree init = build_int_cst (TREE_TYPE (niters), 0);
    tree step = build_int_cst (TREE_TYPE (niters), 1);
!   LOC loop_loc;
    enum tree_code code;
  
    orig_cond = get_loop_exit_condition (loop);
--- 661,667 ----
    bool insert_after;
    tree init = build_int_cst (TREE_TYPE (niters), 0);
    tree step = build_int_cst (TREE_TYPE (niters), 1);
!   source_location loop_loc;
    enum tree_code code;
  
    orig_cond = get_loop_exit_condition (loop);
*************** slpeel_make_loop_iterate_ntimes (struct
*** 691,699 ****
    loop_loc = find_loop_location (loop);
    if (dump_enabled_p ())
      {
!       if (LOCATION_LOCUS (loop_loc) != UNKNOWN_LOC)
! 	dump_printf (MSG_NOTE, "\nloop at %s:%d: ", LOC_FILE (loop_loc),
! 		     LOC_LINE (loop_loc));
        dump_gimple_stmt (MSG_NOTE, TDF_SLIM, cond_stmt, 0);
        dump_printf (MSG_NOTE, "\n");
      }
--- 691,699 ----
    loop_loc = find_loop_location (loop);
    if (dump_enabled_p ())
      {
!       if (LOCATION_LOCUS (loop_loc) != UNKNOWN_LOCATION)
! 	dump_printf (MSG_NOTE, "\nloop at %s:%d: ", LOCATION_FILE (loop_loc),
! 		     LOCATION_LINE (loop_loc));
        dump_gimple_stmt (MSG_NOTE, TDF_SLIM, cond_stmt, 0);
        dump_printf (MSG_NOTE, "\n");
      }
*************** slpeel_tree_peel_loop_to_edge (struct lo
*** 1057,1063 ****
    basic_block new_exit_bb;
    gimple_stmt_iterator gsi;
    edge exit_e = single_exit (loop);
!   LOC loop_loc;
    tree cost_pre_condition = NULL_TREE;
    /* There are many aspects to how likely the first loop is going to be executed.
       Without histogram we can't really do good job.  Simply set it to
--- 1057,1063 ----
    basic_block new_exit_bb;
    gimple_stmt_iterator gsi;
    edge exit_e = single_exit (loop);
!   source_location loop_loc;
    tree cost_pre_condition = NULL_TREE;
    /* There are many aspects to how likely the first loop is going to be executed.
       Without histogram we can't really do good job.  Simply set it to
*************** slpeel_tree_peel_loop_to_edge (struct lo
*** 1365,1371 ****
     location is calculated.
     Return the loop location if succeed and NULL if not.  */
  
! LOC
  find_loop_location (struct loop *loop)
  {
    gimple stmt = NULL;
--- 1365,1371 ----
     location is calculated.
     Return the loop location if succeed and NULL if not.  */
  
! source_location
  find_loop_location (struct loop *loop)
  {
    gimple stmt = NULL;
*************** find_loop_location (struct loop *loop)
*** 1373,1379 ****
    gimple_stmt_iterator si;
  
    if (!loop)
!     return UNKNOWN_LOC;
  
    stmt = get_loop_exit_condition (loop);
  
--- 1373,1379 ----
    gimple_stmt_iterator si;
  
    if (!loop)
!     return UNKNOWN_LOCATION;
  
    stmt = get_loop_exit_condition (loop);
  
*************** find_loop_location (struct loop *loop)
*** 1385,1391 ****
       try to estimate the loop location */
  
    if (!loop->header)
!     return UNKNOWN_LOC;
  
    bb = loop->header;
  
--- 1385,1391 ----
       try to estimate the loop location */
  
    if (!loop->header)
!     return UNKNOWN_LOCATION;
  
    bb = loop->header;
  
*************** find_loop_location (struct loop *loop)
*** 1396,1402 ****
          return gimple_location (stmt);
      }
  
!   return UNKNOWN_LOC;
  }
  
  
--- 1396,1402 ----
          return gimple_location (stmt);
      }
  
!   return UNKNOWN_LOCATION;
  }
  
  
*************** vect_loop_versioning (loop_vec_info loop
*** 2224,2230 ****
    loop_version (loop, cond_expr, &condition_bb,
  		prob, prob, REG_BR_PROB_BASE - prob, true);
  
!   if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
        && dump_enabled_p ())
      {
        if (version_alias)
--- 2222,2228 ----
    loop_version (loop, cond_expr, &condition_bb,
  		prob, prob, REG_BR_PROB_BASE - prob, true);
  
!   if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION
        && dump_enabled_p ())
      {
        if (version_alias)
Index: trunk/gcc/tree-vect-slp.c
===================================================================
*** trunk.orig/gcc/tree-vect-slp.c	2013-11-19 16:21:05.000000000 +0100
--- trunk/gcc/tree-vect-slp.c	2013-11-21 10:41:54.112171939 +0100
*************** along with GCC; see the file COPYING3.
*** 48,70 ****
  /* Extract the location of the basic block in the source code.
     Return the basic block location if succeed and NULL if not.  */
  
! LOC
  find_bb_location (basic_block bb)
  {
    gimple stmt = NULL;
    gimple_stmt_iterator si;
  
    if (!bb)
!     return UNKNOWN_LOC;
  
    for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
      {
        stmt = gsi_stmt (si);
!       if (gimple_location (stmt) != UNKNOWN_LOC)
          return gimple_location (stmt);
      }
  
!   return UNKNOWN_LOC;
  }
  
  
--- 48,70 ----
  /* Extract the location of the basic block in the source code.
     Return the basic block location if succeed and NULL if not.  */
  
! source_location
  find_bb_location (basic_block bb)
  {
    gimple stmt = NULL;
    gimple_stmt_iterator si;
  
    if (!bb)
!     return UNKNOWN_LOCATION;
  
    for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
      {
        stmt = gsi_stmt (si);
!       if (gimple_location (stmt) != UNKNOWN_LOCATION)
          return gimple_location (stmt);
      }
  
!   return UNKNOWN_LOCATION;
  }
  
  
Index: trunk/gcc/tree-vectorizer.c
===================================================================
*** trunk.orig/gcc/tree-vectorizer.c	2013-11-19 16:21:02.000000000 +0100
--- trunk/gcc/tree-vectorizer.c	2013-11-21 10:41:31.237911535 +0100
*************** along with GCC; see the file COPYING3.
*** 79,85 ****
  #include "dbgcnt.h"
  
  /* Loop or bb location.  */
! LOC vect_location;
  
  /* Vector mapping GIMPLE stmt to stmt_vec_info. */
  vec<vec_void_p> stmt_vec_info_vec;
--- 79,85 ----
  #include "dbgcnt.h"
  
  /* Loop or bb location.  */
! source_location vect_location;
  
  /* Vector mapping GIMPLE stmt to stmt_vec_info. */
  vec<vec_void_p> stmt_vec_info_vec;
*************** vectorize_loops (void)
*** 354,363 ****
        {
  	loop_vec_info loop_vinfo;
  	vect_location = find_loop_location (loop);
!         if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
  	    && dump_enabled_p ())
  	  dump_printf (MSG_NOTE, "\nAnalyzing loop at %s:%d\n",
!                        LOC_FILE (vect_location), LOC_LINE (vect_location));
  
  	loop_vinfo = vect_analyze_loop (loop);
  	loop->aux = loop_vinfo;
--- 354,364 ----
        {
  	loop_vec_info loop_vinfo;
  	vect_location = find_loop_location (loop);
!         if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION
  	    && dump_enabled_p ())
  	  dump_printf (MSG_NOTE, "\nAnalyzing loop at %s:%d\n",
!                        LOCATION_FILE (vect_location),
! 		       LOCATION_LINE (vect_location));
  
  	loop_vinfo = vect_analyze_loop (loop);
  	loop->aux = loop_vinfo;
*************** vectorize_loops (void)
*** 368,374 ****
          if (!dbg_cnt (vect_loop))
  	  break;
  
!         if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
  	    && dump_enabled_p ())
            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
                             "loop vectorized\n");
--- 369,375 ----
          if (!dbg_cnt (vect_loop))
  	  break;
  
!         if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION
  	    && dump_enabled_p ())
            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
                             "loop vectorized\n");
*************** vectorize_loops (void)
*** 390,396 ****
  	  }
        }
  
!   vect_location = UNKNOWN_LOC;
  
    statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
    if (dump_enabled_p ()
--- 391,397 ----
  	  }
        }
  
!   vect_location = UNKNOWN_LOCATION;
  
    statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
    if (dump_enabled_p ()
*************** increase_alignment (void)
*** 549,555 ****
  {
    struct varpool_node *vnode;
  
!   vect_location = UNKNOWN_LOC;
  
    /* Increase the alignment of all global arrays for vectorization.  */
    FOR_EACH_DEFINED_VARIABLE (vnode)
--- 550,556 ----
  {
    struct varpool_node *vnode;
  
!   vect_location = UNKNOWN_LOCATION;
  
    /* Increase the alignment of all global arrays for vectorization.  */
    FOR_EACH_DEFINED_VARIABLE (vnode)
Index: trunk/gcc/tree-vectorizer.h
===================================================================
*** trunk.orig/gcc/tree-vectorizer.h	2013-11-21 10:25:02.000000000 +0100
--- trunk/gcc/tree-vectorizer.h	2013-11-21 10:39:14.932359166 +0100
*************** along with GCC; see the file COPYING3.
*** 25,36 ****
  #include "target.h"
  #include "hash-table.h"
  
- typedef source_location LOC;
- #define UNKNOWN_LOC UNKNOWN_LOCATION
- #define EXPR_LOC(e) EXPR_LOCATION (e)
- #define LOC_FILE(l) LOCATION_FILE (l)
- #define LOC_LINE(l) LOCATION_LINE (l)
- 
  /* Used for naming of new temporaries.  */
  enum vect_var_kind {
    vect_simple_var,
--- 25,30 ----
*************** typedef struct _loop_vec_info {
*** 273,281 ****
    /* Unrolling factor  */
    int vectorization_factor;
  
-   /* The loop location in the source.  */
-   LOC loop_line_number;
- 
    /* Unknown DRs according to which loop was peeled.  */
    struct data_reference *unaligned_dr;
  
--- 267,272 ----
*************** typedef struct _loop_vec_info {
*** 343,348 ****
--- 334,343 ----
       this.  */
    bool peeling_for_gaps;
  
+   /* When the number of iterations is not a multiple of the vector size
+      we need to peel off iterations at the end to form an epilogue loop.  */
+   bool peeling_for_niter;
+ 
    /* Reductions are canonicalized so that the last operand is the reduction
       operand.  If this places a constant into RHS1, this decanonicalizes
       GIMPLE for other phases, so we must track when this has occurred and
*************** typedef struct _loop_vec_info {
*** 366,375 ****
  #define LOOP_VINFO_DATAREFS(L)             (L)->datarefs
  #define LOOP_VINFO_DDRS(L)                 (L)->ddrs
  #define LOOP_VINFO_INT_NITERS(L)           (TREE_INT_CST_LOW ((L)->num_iters))
! #define LOOP_PEELING_FOR_ALIGNMENT(L)      (L)->peeling_for_alignment
  #define LOOP_VINFO_UNALIGNED_DR(L)         (L)->unaligned_dr
  #define LOOP_VINFO_MAY_MISALIGN_STMTS(L)   (L)->may_misalign_stmts
- #define LOOP_VINFO_LOC(L)                  (L)->loop_line_number
  #define LOOP_VINFO_MAY_ALIAS_DDRS(L)       (L)->may_alias_ddrs
  #define LOOP_VINFO_COMP_ALIAS_DDRS(L)      (L)->comp_alias_ddrs
  #define LOOP_VINFO_GROUPED_STORES(L)       (L)->grouped_stores
--- 361,369 ----
  #define LOOP_VINFO_DATAREFS(L)             (L)->datarefs
  #define LOOP_VINFO_DDRS(L)                 (L)->ddrs
  #define LOOP_VINFO_INT_NITERS(L)           (TREE_INT_CST_LOW ((L)->num_iters))
! #define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
  #define LOOP_VINFO_UNALIGNED_DR(L)         (L)->unaligned_dr
  #define LOOP_VINFO_MAY_MISALIGN_STMTS(L)   (L)->may_misalign_stmts
  #define LOOP_VINFO_MAY_ALIAS_DDRS(L)       (L)->may_alias_ddrs
  #define LOOP_VINFO_COMP_ALIAS_DDRS(L)      (L)->comp_alias_ddrs
  #define LOOP_VINFO_GROUPED_STORES(L)       (L)->grouped_stores
*************** unlimited_cost_model ()
*** 925,931 ****
  }
  
  /* Source location */
! extern LOC vect_location;
  
  /*-----------------------------------------------------------------*/
  /* Function prototypes.                                            */
--- 916,922 ----
  }
  
  /* Source location */
! extern source_location vect_location;
  
  /*-----------------------------------------------------------------*/
  /* Function prototypes.                                            */
*************** extern void vect_do_peeling_for_loop_bou
*** 941,947 ****
  					    unsigned int, bool);
  extern void vect_do_peeling_for_alignment (loop_vec_info, tree,
  					   unsigned int, bool);
! extern LOC find_loop_location (struct loop *);
  extern bool vect_can_advance_ivs_p (loop_vec_info);
  
  /* In tree-vect-stmts.c.  */
--- 932,938 ----
  					    unsigned int, bool);
  extern void vect_do_peeling_for_alignment (loop_vec_info, tree,
  					   unsigned int, bool);
! extern source_location find_loop_location (struct loop *);
  extern bool vect_can_advance_ivs_p (loop_vec_info);
  
  /* In tree-vect-stmts.c.  */
*************** extern void vect_detect_hybrid_slp (loop
*** 1072,1078 ****
  extern void vect_get_slp_defs (vec<tree> , slp_tree,
  			       vec<vec<tree> > *, int);
  
! extern LOC find_bb_location (basic_block);
  extern bb_vec_info vect_slp_analyze_bb (basic_block);
  extern void vect_slp_transform_bb (basic_block);
  
--- 1063,1069 ----
  extern void vect_get_slp_defs (vec<tree> , slp_tree,
  			       vec<vec<tree> > *, int);
  
! extern source_location find_bb_location (basic_block);
  extern bb_vec_info vect_slp_analyze_bb (basic_block);
  extern void vect_slp_transform_bb (basic_block);
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]