Re: [14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info

2018-08-02 Thread Richard Sandiford
"H.J. Lu"  writes:
> On Tue, Jul 24, 2018 at 2:58 AM, Richard Sandiford
>  wrote:
>> This patch changes STMT_VINFO_VEC_STMT from a gimple stmt to a
>> stmt_vec_info and makes the vectorizable_* routines pass back
>> a stmt_vec_info to vect_transform_stmt.
>>
>>
>> 2018-07-24  Richard Sandiford  
>>
>> gcc/
>> * tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Change from
>> a gimple stmt to a stmt_vec_info.
>> (vectorizable_condition, vectorizable_live_operation)
>> (vectorizable_reduction, vectorizable_induction): Pass back the
>> vectorized statement as a stmt_vec_info.
>> * tree-vect-data-refs.c (vect_record_grouped_load_vectors): Update
>> use of STMT_VINFO_VEC_STMT.
>> * tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise,
>> accumulating the inner phis that feed the STMT_VINFO_VEC_STMT
>> as stmt_vec_infos rather than gimple stmts.
>> (vectorize_fold_left_reduction): Change vec_stmt from a gimple stmt
>> to a stmt_vec_info.
>> (vectorizable_live_operation): Likewise.
>> (vectorizable_reduction, vectorizable_induction): Likewise,
>> updating use of STMT_VINFO_VEC_STMT.
>> * tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Update use
>> of STMT_VINFO_VEC_STMT.
>> (vect_build_gather_load_calls, vectorizable_bswap, vectorizable_call)
>> (vectorizable_simd_clone_call, vectorizable_conversion)
>> (vectorizable_assignment, vectorizable_shift, vectorizable_operation)
>> (vectorizable_store, vectorizable_load, vectorizable_condition)
>> (vectorizable_comparison, can_vectorize_live_stmts): Change vec_stmt
>> from a gimple stmt to a stmt_vec_info.
>> (vect_transform_stmt): Update use of STMT_VINFO_VEC_STMT.  Pass a
>> pointer to a stmt_vec_info to the vectorizable_* routines.
>>
>
> This caused:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86824

Should be fixed by r263222 (tested on an x86 SPEC2k6 run).
Sorry again for the breakage.

Richard


Re: [14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info

2018-08-01 Thread H.J. Lu
On Tue, Jul 24, 2018 at 2:58 AM, Richard Sandiford
 wrote:
> This patch changes STMT_VINFO_VEC_STMT from a gimple stmt to a
> stmt_vec_info and makes the vectorizable_* routines pass back
> a stmt_vec_info to vect_transform_stmt.
>
>
> 2018-07-24  Richard Sandiford  
>
> gcc/
> * tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Change from
> a gimple stmt to a stmt_vec_info.
> (vectorizable_condition, vectorizable_live_operation)
> (vectorizable_reduction, vectorizable_induction): Pass back the
> vectorized statement as a stmt_vec_info.
> * tree-vect-data-refs.c (vect_record_grouped_load_vectors): Update
> use of STMT_VINFO_VEC_STMT.
> * tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise,
> accumulating the inner phis that feed the STMT_VINFO_VEC_STMT
> as stmt_vec_infos rather than gimple stmts.
> (vectorize_fold_left_reduction): Change vec_stmt from a gimple stmt
> to a stmt_vec_info.
> (vectorizable_live_operation): Likewise.
> (vectorizable_reduction, vectorizable_induction): Likewise,
> updating use of STMT_VINFO_VEC_STMT.
> * tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Update use
> of STMT_VINFO_VEC_STMT.
> (vect_build_gather_load_calls, vectorizable_bswap, vectorizable_call)
> (vectorizable_simd_clone_call, vectorizable_conversion)
> (vectorizable_assignment, vectorizable_shift, vectorizable_operation)
> (vectorizable_store, vectorizable_load, vectorizable_condition)
> (vectorizable_comparison, can_vectorize_live_stmts): Change vec_stmt
> from a gimple stmt to a stmt_vec_info.
> (vect_transform_stmt): Update use of STMT_VINFO_VEC_STMT.  Pass a
> pointer to a stmt_vec_info to the vectorizable_* routines.
>

This caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86824

-- 
H.J.


Re: [14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info

2018-07-25 Thread Richard Sandiford
Richard Biener  writes:
> On Tue, Jul 24, 2018 at 11:58 AM Richard Sandiford
>  wrote:
>>
>> This patch changes STMT_VINFO_VEC_STMT from a gimple stmt to a
>> stmt_vec_info and makes the vectorizable_* routines pass back
>> a stmt_vec_info to vect_transform_stmt.
>
> OK, but - I don't think we ever "use" that stmt_info on vectorized stmts apart
> from the chaining via related-stmt?  I'd also like to get rid of that chaining
> and instead do sth similar to SLP where we simply have a vec<> of
> vectorized stmts.

Yeah, agree that would be better.

Thanks,
Richard

>
> Richard.
>
>>
>> 2018-07-24  Richard Sandiford  
>>
>> gcc/
>> * tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Change from
>> a gimple stmt to a stmt_vec_info.
>> (vectorizable_condition, vectorizable_live_operation)
>> (vectorizable_reduction, vectorizable_induction): Pass back the
>> vectorized statement as a stmt_vec_info.
>> * tree-vect-data-refs.c (vect_record_grouped_load_vectors): Update
>> use of STMT_VINFO_VEC_STMT.
>> * tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise,
>> accumulating the inner phis that feed the STMT_VINFO_VEC_STMT
>> as stmt_vec_infos rather than gimple stmts.
>> (vectorize_fold_left_reduction): Change vec_stmt from a gimple stmt
>> to a stmt_vec_info.
>> (vectorizable_live_operation): Likewise.
>> (vectorizable_reduction, vectorizable_induction): Likewise,
>> updating use of STMT_VINFO_VEC_STMT.
>> * tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Update use
>> of STMT_VINFO_VEC_STMT.
>> (vect_build_gather_load_calls, vectorizable_bswap, vectorizable_call)
>> (vectorizable_simd_clone_call, vectorizable_conversion)
>> (vectorizable_assignment, vectorizable_shift, vectorizable_operation)
>> (vectorizable_store, vectorizable_load, vectorizable_condition)
>> (vectorizable_comparison, can_vectorize_live_stmts): Change vec_stmt
>> from a gimple stmt to a stmt_vec_info.
>> (vect_transform_stmt): Update use of STMT_VINFO_VEC_STMT.  Pass a
>> pointer to a stmt_vec_info to the vectorizable_* routines.
>>
>> Index: gcc/tree-vectorizer.h
>> ===
>> --- gcc/tree-vectorizer.h   2018-07-24 10:22:44.297185652 +0100
>> +++ gcc/tree-vectorizer.h   2018-07-24 10:22:47.489157307 +0100
>> @@ -812,7 +812,7 @@ struct _stmt_vec_info {
>>tree vectype;
>>
>>/* The vectorized version of the stmt.  */
>> -  gimple *vectorized_stmt;
>> +  stmt_vec_info vectorized_stmt;
>>
>>
>>/* The following is relevant only for stmts that contain a non-scalar
>> @@ -1560,7 +1560,7 @@ extern void vect_remove_stores (gimple *
>>  extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance,
>>stmt_vector_for_cost *);
>>  extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *,
>> -   gimple **, tree, int, slp_tree,
>> +   stmt_vec_info *, tree, int, slp_tree,
>> stmt_vector_for_cost *);
>>  extern void vect_get_load_cost (stmt_vec_info, int, bool,
>> unsigned int *, unsigned int *,
>> @@ -1649,13 +1649,13 @@ extern tree vect_get_loop_mask (gimple_s
>>  extern struct loop *vect_transform_loop (loop_vec_info);
>> extern loop_vec_info vect_analyze_loop_form (struct loop *,
> vec_info_shared *);
>>  extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *,
>> -slp_tree, int, gimple **,
>> +slp_tree, int, stmt_vec_info *,
>>  stmt_vector_for_cost *);
>>  extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *,
>> -   gimple **, slp_tree, slp_instance,
>> +   stmt_vec_info *, slp_tree, slp_instance,
>> stmt_vector_for_cost *);
>>  extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *,
>> -   gimple **, slp_tree,
>> +   stmt_vec_info *, slp_tree,
>> stmt_vector_for_cost *);
>>  extern tree get_initial_def_for_reduction (gimple *, tree, tree *);
>>  extern bool vect_worthwhile_without_simd_p (vec_info *, tree_code);
>> Index: gcc/tree-vect-data-refs.c
>> ===
>> --- gcc/tree-vect-data-refs.c   2018-07-24 10:22:44.285185759 +0100
>> +++ gcc/tree-vect-data-refs.c   2018-07-24 10:22:47.485157343 +0100
>> @@ -6401,18 +6401,17 @@ vect_record_grouped_load_vectors (gimple
>>  {
>>if (!DR_GROUP_SAME_DR_STMT (vinfo_for_stmt (next_stmt)))
>>   

Re: [14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info

2018-07-25 Thread Richard Biener
On Tue, Jul 24, 2018 at 11:58 AM Richard Sandiford
 wrote:
>
> This patch changes STMT_VINFO_VEC_STMT from a gimple stmt to a
> stmt_vec_info and makes the vectorizable_* routines pass back
> a stmt_vec_info to vect_transform_stmt.

OK, but - I don't think we ever "use" that stmt_info on vectorized stmts apart
from the chaining via related-stmt?  I'd also like to get rid of that chaining
and instead do sth similar to SLP where we simply have a vec<> of
vectorized stmts.

Richard.

>
> 2018-07-24  Richard Sandiford  
>
> gcc/
> * tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Change from
> a gimple stmt to a stmt_vec_info.
> (vectorizable_condition, vectorizable_live_operation)
> (vectorizable_reduction, vectorizable_induction): Pass back the
> vectorized statement as a stmt_vec_info.
> * tree-vect-data-refs.c (vect_record_grouped_load_vectors): Update
> use of STMT_VINFO_VEC_STMT.
> * tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise,
> accumulating the inner phis that feed the STMT_VINFO_VEC_STMT
> as stmt_vec_infos rather than gimple stmts.
> (vectorize_fold_left_reduction): Change vec_stmt from a gimple stmt
> to a stmt_vec_info.
> (vectorizable_live_operation): Likewise.
> (vectorizable_reduction, vectorizable_induction): Likewise,
> updating use of STMT_VINFO_VEC_STMT.
> * tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Update use
> of STMT_VINFO_VEC_STMT.
> (vect_build_gather_load_calls, vectorizable_bswap, vectorizable_call)
> (vectorizable_simd_clone_call, vectorizable_conversion)
> (vectorizable_assignment, vectorizable_shift, vectorizable_operation)
> (vectorizable_store, vectorizable_load, vectorizable_condition)
> (vectorizable_comparison, can_vectorize_live_stmts): Change vec_stmt
> from a gimple stmt to a stmt_vec_info.
> (vect_transform_stmt): Update use of STMT_VINFO_VEC_STMT.  Pass a
> pointer to a stmt_vec_info to the vectorizable_* routines.
>
> Index: gcc/tree-vectorizer.h
> ===
> --- gcc/tree-vectorizer.h   2018-07-24 10:22:44.297185652 +0100
> +++ gcc/tree-vectorizer.h   2018-07-24 10:22:47.489157307 +0100
> @@ -812,7 +812,7 @@ struct _stmt_vec_info {
>tree vectype;
>
>/* The vectorized version of the stmt.  */
> -  gimple *vectorized_stmt;
> +  stmt_vec_info vectorized_stmt;
>
>
>/* The following is relevant only for stmts that contain a non-scalar
> @@ -1560,7 +1560,7 @@ extern void vect_remove_stores (gimple *
>  extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance,
>stmt_vector_for_cost *);
>  extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *,
> -   gimple **, tree, int, slp_tree,
> +   stmt_vec_info *, tree, int, slp_tree,
> stmt_vector_for_cost *);
>  extern void vect_get_load_cost (stmt_vec_info, int, bool,
> unsigned int *, unsigned int *,
> @@ -1649,13 +1649,13 @@ extern tree vect_get_loop_mask (gimple_s
>  extern struct loop *vect_transform_loop (loop_vec_info);
>  extern loop_vec_info vect_analyze_loop_form (struct loop *, vec_info_shared 
> *);
>  extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *,
> -slp_tree, int, gimple **,
> +slp_tree, int, stmt_vec_info *,
>  stmt_vector_for_cost *);
>  extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *,
> -   gimple **, slp_tree, slp_instance,
> +   stmt_vec_info *, slp_tree, slp_instance,
> stmt_vector_for_cost *);
>  extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *,
> -   gimple **, slp_tree,
> +   stmt_vec_info *, slp_tree,
> stmt_vector_for_cost *);
>  extern tree get_initial_def_for_reduction (gimple *, tree, tree *);
>  extern bool vect_worthwhile_without_simd_p (vec_info *, tree_code);
> Index: gcc/tree-vect-data-refs.c
> ===
> --- gcc/tree-vect-data-refs.c   2018-07-24 10:22:44.285185759 +0100
> +++ gcc/tree-vect-data-refs.c   2018-07-24 10:22:47.485157343 +0100
> @@ -6401,18 +6401,17 @@ vect_record_grouped_load_vectors (gimple
>  {
>if (!DR_GROUP_SAME_DR_STMT (vinfo_for_stmt (next_stmt)))
>  {
> - gimple *prev_stmt =
> -   STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
> + stmt_vec_info 

[14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info

2018-07-24 Thread Richard Sandiford
This patch changes STMT_VINFO_VEC_STMT from a gimple stmt to a
stmt_vec_info and makes the vectorizable_* routines pass back
a stmt_vec_info to vect_transform_stmt.


2018-07-24  Richard Sandiford  

gcc/
* tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Change from
a gimple stmt to a stmt_vec_info.
(vectorizable_condition, vectorizable_live_operation)
(vectorizable_reduction, vectorizable_induction): Pass back the
vectorized statement as a stmt_vec_info.
* tree-vect-data-refs.c (vect_record_grouped_load_vectors): Update
use of STMT_VINFO_VEC_STMT.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise,
accumulating the inner phis that feed the STMT_VINFO_VEC_STMT
as stmt_vec_infos rather than gimple stmts.
(vectorize_fold_left_reduction): Change vec_stmt from a gimple stmt
to a stmt_vec_info.
(vectorizable_live_operation): Likewise.
(vectorizable_reduction, vectorizable_induction): Likewise,
updating use of STMT_VINFO_VEC_STMT.
* tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Update use
of STMT_VINFO_VEC_STMT.
(vect_build_gather_load_calls, vectorizable_bswap, vectorizable_call)
(vectorizable_simd_clone_call, vectorizable_conversion)
(vectorizable_assignment, vectorizable_shift, vectorizable_operation)
(vectorizable_store, vectorizable_load, vectorizable_condition)
(vectorizable_comparison, can_vectorize_live_stmts): Change vec_stmt
from a gimple stmt to a stmt_vec_info.
(vect_transform_stmt): Update use of STMT_VINFO_VEC_STMT.  Pass a
pointer to a stmt_vec_info to the vectorizable_* routines.

Index: gcc/tree-vectorizer.h
===
--- gcc/tree-vectorizer.h   2018-07-24 10:22:44.297185652 +0100
+++ gcc/tree-vectorizer.h   2018-07-24 10:22:47.489157307 +0100
@@ -812,7 +812,7 @@ struct _stmt_vec_info {
   tree vectype;
 
   /* The vectorized version of the stmt.  */
-  gimple *vectorized_stmt;
+  stmt_vec_info vectorized_stmt;
 
 
   /* The following is relevant only for stmts that contain a non-scalar
@@ -1560,7 +1560,7 @@ extern void vect_remove_stores (gimple *
 extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance,
   stmt_vector_for_cost *);
 extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *,
-   gimple **, tree, int, slp_tree,
+   stmt_vec_info *, tree, int, slp_tree,
stmt_vector_for_cost *);
 extern void vect_get_load_cost (stmt_vec_info, int, bool,
unsigned int *, unsigned int *,
@@ -1649,13 +1649,13 @@ extern tree vect_get_loop_mask (gimple_s
 extern struct loop *vect_transform_loop (loop_vec_info);
 extern loop_vec_info vect_analyze_loop_form (struct loop *, vec_info_shared *);
 extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *,
-slp_tree, int, gimple **,
+slp_tree, int, stmt_vec_info *,
 stmt_vector_for_cost *);
 extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *,
-   gimple **, slp_tree, slp_instance,
+   stmt_vec_info *, slp_tree, slp_instance,
stmt_vector_for_cost *);
 extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *,
-   gimple **, slp_tree,
+   stmt_vec_info *, slp_tree,
stmt_vector_for_cost *);
 extern tree get_initial_def_for_reduction (gimple *, tree, tree *);
 extern bool vect_worthwhile_without_simd_p (vec_info *, tree_code);
Index: gcc/tree-vect-data-refs.c
===
--- gcc/tree-vect-data-refs.c   2018-07-24 10:22:44.285185759 +0100
+++ gcc/tree-vect-data-refs.c   2018-07-24 10:22:47.485157343 +0100
@@ -6401,18 +6401,17 @@ vect_record_grouped_load_vectors (gimple
 {
   if (!DR_GROUP_SAME_DR_STMT (vinfo_for_stmt (next_stmt)))
 {
- gimple *prev_stmt =
-   STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
+ stmt_vec_info prev_stmt_info
+   = STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
  stmt_vec_info rel_stmt_info
-   = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt));
+   = STMT_VINFO_RELATED_STMT (prev_stmt_info);
  while (rel_stmt_info)
{
- prev_stmt = rel_stmt_info;
+ prev_stmt_info = rel_stmt_info;
  rel_stmt_info =