diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2022-10-20 15:54:39 +0100 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2022-10-20 15:54:39 +0100 |
commit | e10ca9544632dbff4759b4b92886cd96d0b9bdfe (patch) | |
tree | 829f428e858d0fa82e66f4213c08ec2c7125c4d6 /gcc/tree-vect-patterns.cc | |
parent | 7bf3a4d36a8e59297ea65dd479ffe696f0974303 (diff) | |
download | gcc-e10ca9544632dbff4759b4b92886cd96d0b9bdfe.zip gcc-e10ca9544632dbff4759b4b92886cd96d0b9bdfe.tar.gz gcc-e10ca9544632dbff4759b4b92886cd96d0b9bdfe.tar.bz2 |
vect: Fix vectype when widening container type in bitfield pattern [PR107326]
The 'vect_recog_bitfield_ref_pattern' was not correctly adapting the vectype
when widening the container.
gcc/ChangeLog:
PR tree-optimization/107326
* tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Change
vectype when widening container.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/pr107326.c: New test.
* gcc.dg/vect/vect-bitfield-read-7.c: New test.
Diffstat (limited to 'gcc/tree-vect-patterns.cc')
-rw-r--r-- | gcc/tree-vect-patterns.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index d18e1e6..777ba2f 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -1922,7 +1922,8 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info, tree ret = gimple_assign_lhs (first_stmt); tree ret_type = TREE_TYPE (ret); bool shift_first = true; - tree vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (container)); + tree container_type = TREE_TYPE (container); + tree vectype = get_vectype_for_scalar_type (vinfo, container_type); /* We move the conversion earlier if the loaded type is smaller than the return type to enable the use of widening loads. */ @@ -1933,15 +1934,15 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info, = gimple_build_assign (vect_recog_temp_ssa_var (ret_type), NOP_EXPR, container); container = gimple_get_lhs (pattern_stmt); - append_pattern_def_seq (vinfo, stmt_info, pattern_stmt); + container_type = TREE_TYPE (container); + vectype = get_vectype_for_scalar_type (vinfo, container_type); + append_pattern_def_seq (vinfo, stmt_info, pattern_stmt, vectype); } else if (!useless_type_conversion_p (TREE_TYPE (container), ret_type)) /* If we are doing the conversion last then also delay the shift as we may be able to combine the shift and conversion in certain cases. */ shift_first = false; - tree container_type = TREE_TYPE (container); - /* If the only use of the result of this BIT_FIELD_REF + CONVERT is a PLUS_EXPR then do the shift last as some targets can combine the shift and add into a single instruction. */ |