aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-patterns.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-10-01 09:29:32 +0200
committerRichard Biener <rguenther@suse.de>2020-10-01 10:22:18 +0200
commit36e691d3a62145fda1f4a1b3143d215cc113c10a (patch)
tree1cc5121575fddb868b318e72ab631bf480d67154 /gcc/tree-vect-patterns.c
parent324bec558e95584e8c1997575ae9d75978af59f1 (diff)
downloadgcc-36e691d3a62145fda1f4a1b3143d215cc113c10a.zip
gcc-36e691d3a62145fda1f4a1b3143d215cc113c10a.tar.gz
gcc-36e691d3a62145fda1f4a1b3143d215cc113c10a.tar.bz2
tree-optimization/97255 - missing vector bool pattern of SRAed bool
SRA tends to use VIEW_CONVERT_EXPR when replacing bool fields with unsigned char fields. Those are not handled in vector bool pattern detection causing vector true values to leak. The following fixes this by turning those into b ? 1 : 0 as well. 2020-10-01 Richard Biener <rguenther@suse.de> * tree-vect-patterns.c (vect_recog_bool_pattern): Also handle VIEW_CONVERT_EXPR. * g++.dg/vect/pr97255.cc: New testcase.
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r--gcc/tree-vect-patterns.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index db45740..d626c5f 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -4028,14 +4028,18 @@ vect_recog_bool_pattern (vec_info *vinfo,
var = gimple_assign_rhs1 (last_stmt);
lhs = gimple_assign_lhs (last_stmt);
+ rhs_code = gimple_assign_rhs_code (last_stmt);
+
+ if (rhs_code == VIEW_CONVERT_EXPR)
+ var = TREE_OPERAND (var, 0);
if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (var)))
return NULL;
hash_set<gimple *> bool_stmts;
- rhs_code = gimple_assign_rhs_code (last_stmt);
- if (CONVERT_EXPR_CODE_P (rhs_code))
+ if (CONVERT_EXPR_CODE_P (rhs_code)
+ || rhs_code == VIEW_CONVERT_EXPR)
{
if (! INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| TYPE_PRECISION (TREE_TYPE (lhs)) == 1)