aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-04-28 10:41:41 +0200
committerRichard Biener <rguenther@suse.de>2021-04-28 12:03:49 +0200
commitf7ee6a1e8ac62950dd32874bf75e748a2895d595 (patch)
treeaaf3072b3e68b2574027e52d392f86bcdf21ff03 /gcc
parentf9d670128f6e6b3631a2db575ddf6f19fa43afdc (diff)
downloadgcc-f7ee6a1e8ac62950dd32874bf75e748a2895d595.zip
gcc-f7ee6a1e8ac62950dd32874bf75e748a2895d595.tar.gz
gcc-f7ee6a1e8ac62950dd32874bf75e748a2895d595.tar.bz2
tree-optimization/100292 - avoid invalid GIMPLE from vector lowering
We have to avoid folding the condition when building a COND_EXPR since we no longer gimplify the whole thing. The folding done at COND_EXPR build time will deal with possible simplifications. 2021-04-28 Richard Biener <rguenther@suse.de> PR tree-optimization/100292 * tree-vect-generic.c (expand_vector_condition): Do not fold the comparisons. * gcc.dg/pr100292.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/pr100292.c11
-rw-r--r--gcc/tree-vect-generic.c6
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/testsuite/gcc.dg/pr100292.c b/gcc/testsuite/gcc.dg/pr100292.c
new file mode 100644
index 0000000..675a60c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100292.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+typedef unsigned char __attribute__((__vector_size__ (4))) V;
+
+extern void bar (V v);
+
+void
+foo (char c)
+{
+ bar (c <= (V) 127);
+}
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 5cc32c4..d9c0ac9 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1116,15 +1116,15 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names)
comp_width, comp_index);
tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2,
comp_width, comp_index);
- aa = fold_build2 (code, cond_type, aa1, aa2);
+ aa = build2 (code, cond_type, aa1, aa2);
}
else if (a_is_scalar_bitmask)
{
wide_int w = wi::set_bit_in_zero (i, TYPE_PRECISION (TREE_TYPE (a)));
result = gimplify_build2 (gsi, BIT_AND_EXPR, TREE_TYPE (a),
a, wide_int_to_tree (TREE_TYPE (a), w));
- aa = fold_build2 (NE_EXPR, boolean_type_node, result,
- build_zero_cst (TREE_TYPE (a)));
+ aa = build2 (NE_EXPR, boolean_type_node, result,
+ build_zero_cst (TREE_TYPE (a)));
}
else
aa = tree_vec_extract (gsi, cond_type, a, width, index);