diff options
author | Richard Biener <rguenther@suse.de> | 2021-07-16 13:26:20 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-07-16 14:29:06 +0200 |
commit | 650c70a9fe7198394d3bbe4c0b1a7a73dc0bdd4a (patch) | |
tree | 2309cf7bc3c35d8aed0853a76bfa6fa506edaf3f /gcc/tree-vect-data-refs.c | |
parent | 8da8ed435e9f01b37bf4ee57fa62509d44121c7d (diff) | |
download | gcc-650c70a9fe7198394d3bbe4c0b1a7a73dc0bdd4a.zip gcc-650c70a9fe7198394d3bbe4c0b1a7a73dc0bdd4a.tar.gz gcc-650c70a9fe7198394d3bbe4c0b1a7a73dc0bdd4a.tar.bz2 |
Remove more gimple_expr_type uses
This removes a few more uses.
2021-07-16 Richard Biener <rguenther@suse.de>
* gimple-ssa-store-merging.c (verify_symbolic_number_p): Use
the type of the LHS.
(find_bswap_or_nop_1): Likewise.
(find_bswap_or_nop): Likewise.
* tree-vectorizer.h (vect_get_smallest_scalar_type): Adjust
prototype.
* tree-vect-data-refs.c (vect_get_smallest_scalar_type):
Remove unused parameters, pass in the scalar type. Fix
internal store function handling.
* tree-vect-stmts.c (vect_analyze_stmt): Remove assert.
(vect_get_vector_types_for_stmt): Move down check for
existing vector stmt after we've determined a scalar type.
Pass down the used scalar type to vect_get_smallest_scalar_type.
* tree-vect-generic.c (expand_vector_condition): Use
the type of the LHS.
(expand_vector_scalar_condition): Likewise.
(expand_vector_operations_1): Likewise.
* tree-vect-patterns.c (vect_widened_op_tree): Likewise.
(vect_recog_dot_prod_pattern): Likewise.
(vect_recog_sad_pattern): Likewise.
(vect_recog_widen_op_pattern): Likewise.
(vect_recog_widen_sum_pattern): Likewise.
(vect_recog_mixed_size_cond_pattern): Likewise.
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 579149d..6995efb 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -116,11 +116,8 @@ vect_lanes_optab_supported_p (const char *name, convert_optab optab, types. */ tree -vect_get_smallest_scalar_type (stmt_vec_info stmt_info, - HOST_WIDE_INT *lhs_size_unit, - HOST_WIDE_INT *rhs_size_unit) +vect_get_smallest_scalar_type (stmt_vec_info stmt_info, tree scalar_type) { - tree scalar_type = gimple_expr_type (stmt_info->stmt); HOST_WIDE_INT lhs, rhs; /* During the analysis phase, this function is called on arbitrary @@ -131,21 +128,24 @@ vect_get_smallest_scalar_type (stmt_vec_info stmt_info, lhs = rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type)); gassign *assign = dyn_cast <gassign *> (stmt_info->stmt); - if (assign - && (gimple_assign_cast_p (assign) + if (assign) + { + scalar_type = TREE_TYPE (gimple_assign_lhs (assign)); + if (gimple_assign_cast_p (assign) || gimple_assign_rhs_code (assign) == DOT_PROD_EXPR || gimple_assign_rhs_code (assign) == WIDEN_SUM_EXPR || gimple_assign_rhs_code (assign) == WIDEN_MULT_EXPR || gimple_assign_rhs_code (assign) == WIDEN_LSHIFT_EXPR || gimple_assign_rhs_code (assign) == WIDEN_PLUS_EXPR || gimple_assign_rhs_code (assign) == WIDEN_MINUS_EXPR - || gimple_assign_rhs_code (assign) == FLOAT_EXPR)) - { - tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (assign)); + || gimple_assign_rhs_code (assign) == FLOAT_EXPR) + { + tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (assign)); - rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type)); - if (rhs < lhs) - scalar_type = rhs_type; + rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type)); + if (rhs < lhs) + scalar_type = rhs_type; + } } else if (gcall *call = dyn_cast <gcall *> (stmt_info->stmt)) { @@ -153,10 +153,16 @@ vect_get_smallest_scalar_type (stmt_vec_info stmt_info, if (gimple_call_internal_p (call)) { internal_fn ifn = gimple_call_internal_fn (call); - if (internal_load_fn_p (ifn) || internal_store_fn_p (ifn)) - /* gimple_expr_type already picked the type of the loaded - or stored data. */ + if (internal_load_fn_p (ifn)) + /* For loads the LHS type does the trick. */ i = ~0U; + else if (internal_store_fn_p (ifn)) + { + /* For stores use the tyep of the stored value. */ + i = internal_fn_stored_value_index (ifn); + scalar_type = TREE_TYPE (gimple_call_arg (call, i)); + i = ~0U; + } else if (internal_fn_mask_index (ifn) == 0) i = 1; } @@ -172,8 +178,6 @@ vect_get_smallest_scalar_type (stmt_vec_info stmt_info, } } - *lhs_size_unit = lhs; - *rhs_size_unit = rhs; return scalar_type; } |