Commit 2568d8a1 by Jakub Jelinek

re PR tree-optimization/79284 (ICE on valid code at -O3 on x86_64-linux-gnu: verify_gimple failed)

	PR tree-optimization/79284
	* tree-vectorizer.h (VECT_SCALAR_BOOLEAN_TYPE_P): Define.
	* tree-vect-stmts.c (vect_get_vec_def_for_operand,
	vectorizable_mask_load_store, vectorizable_operation,
	vect_is_simple_cond, get_same_sized_vectype): Use it instead
	of comparing TREE_CODE of a type against BOOLEAN_TYPE.
	* tree-vect-patterns.c (check_bool_pattern, search_type_for_mask_1,
	vect_recog_bool_pattern, vect_recog_mask_conversion_pattern): Likewise.
	* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
	* tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
	Remove redundant gimple_code (stmt) == GIMPLE_ASSIGN test after
	is_gimple_assign (stmt).  Replace another such test with
	is_gimple_assign (stmt).
testsuite/
	* gcc.c-torture/compile/pr79284.c: New test.

From-SVN: r245214
parent aae936b9
2017-02-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79284
* tree-vectorizer.h (VECT_SCALAR_BOOLEAN_TYPE_P): Define.
* tree-vect-stmts.c (vect_get_vec_def_for_operand,
vectorizable_mask_load_store, vectorizable_operation,
vect_is_simple_cond, get_same_sized_vectype): Use it instead
of comparing TREE_CODE of a type against BOOLEAN_TYPE.
* tree-vect-patterns.c (check_bool_pattern, search_type_for_mask_1,
vect_recog_bool_pattern, vect_recog_mask_conversion_pattern): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
Remove redundant gimple_code (stmt) == GIMPLE_ASSIGN test after
is_gimple_assign (stmt). Replace another such test with
is_gimple_assign (stmt).
2017-02-06 Georg-Johann Lay <avr@gjlay.de> 2017-02-06 Georg-Johann Lay <avr@gjlay.de>
PR target/78883
* config/avr/avr.c (rtl-iter.h): Include it.
(TARGET_LEGITIMATE_COMBINED_INSN): New hook define...
(avr_legitimate_combined_insn): ...and implementation.
2017-02-06 Dominik Vogt <vogt@linux.vnet.ibm.com> 2017-02-06 Dominik Vogt <vogt@linux.vnet.ibm.com>
* config/s390/predicates.md ("larl_operand"): Use macros from hwint.h. * config/s390/predicates.md ("larl_operand"): Use macros from hwint.h.
......
2017-02-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79284
* gcc.c-torture/compile/pr79284.c: New test.
2017-02-06 Paolo Carlini <paolo.carlini@oracle.com> 2017-02-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70448 PR c++/70448
...@@ -67,8 +72,8 @@ ...@@ -67,8 +72,8 @@
PR tree-optimization/79327 PR tree-optimization/79327
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust. * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
* gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-13.c: New test.
* gcc/testsuite/gcc.dg/tree-ssa/pr79327-2.c: Ditto. * gcc.dg/tree-ssa/pr79327-2.c: Ditto.
2017-02-03 Jakub Jelinek <jakub@redhat.com> 2017-02-03 Jakub Jelinek <jakub@redhat.com>
Martin Sebor <msebor@redhat.com> Martin Sebor <msebor@redhat.com>
...@@ -353,7 +358,7 @@ ...@@ -353,7 +358,7 @@
2017-01-27 Vladimir Makarov <vmakarov@redhat.com> 2017-01-27 Vladimir Makarov <vmakarov@redhat.com>
PR tree-optimization/71374 PR tree-optimization/71374
* testsuite/gcc.target/i386/pr71374.c: New. * gcc.target/i386/pr71374.c: New.
2017-01-27 Martin Sebor <msebor@redhat.com> 2017-01-27 Martin Sebor <msebor@redhat.com>
...@@ -531,9 +536,9 @@ ...@@ -531,9 +536,9 @@
* g++.dg/ext/flexary18.C: Same. * g++.dg/ext/flexary18.C: Same.
* g++.dg/ext/flexary19.C: Same. * g++.dg/ext/flexary19.C: Same.
* g++.dg/ext/flexary7.C: Same. * g++.dg/ext/flexary7.C: Same.
* gcc/testsuite/g++.dg/cpp1z/has-unique-obj-representations1.C: Same. * g++.dg/cpp1z/has-unique-obj-representations1.C: Same.
* gcc/testsuite/g++.dg/ubsan/object-size-1.C: Same. * g++.dg/ubsan/object-size-1.C: Same.
* gcc/testsuite/obj-c++.dg/property/at-property-23.mm: Same. * obj-c++.dg/property/at-property-23.mm: Same.
2017-01-25 Jakub Jelinek <jakub@redhat.com> 2017-01-25 Jakub Jelinek <jakub@redhat.com>
...@@ -921,10 +926,10 @@ ...@@ -921,10 +926,10 @@
2017-01-20 Jiong Wang <jiong.wang@arm.com> 2017-01-20 Jiong Wang <jiong.wang@arm.com>
* testsuite/gcc.target/aarch64/return_address_sign_1.c: Enable on LP64 * gcc.target/aarch64/return_address_sign_1.c: Enable on LP64
only. only.
* testsuite/gcc.target/aarch64/return_address_sign_2.c: Likewise. * gcc.target/aarch64/return_address_sign_2.c: Likewise.
* testsuite/gcc.target/aarch64/return_address_sign_3.c: Likewise. * gcc.target/aarch64/return_address_sign_3.c: Likewise.
2017-01-20 Nathan Sidwell <nathan@acm.org> 2017-01-20 Nathan Sidwell <nathan@acm.org>
...@@ -1039,7 +1044,7 @@ ...@@ -1039,7 +1044,7 @@
2017-01-19 Tamar Christina <tamar.christina@arm.com> 2017-01-19 Tamar Christina <tamar.christina@arm.com>
* gcc/testsuite/lib/target-supports.exp * lib/target-supports.exp
(check_effective_target_vect_call_copysignf): Enable for AArch64. (check_effective_target_vect_call_copysignf): Enable for AArch64.
2017-01-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2017-01-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
......
/* PR tree-optimization/79284 */
struct S { unsigned a : 1; } b;
int c[64];
int
foo (int x)
{
char e, f;
for (e = 63; e; e--)
f = (c[e] && ~0) != b.a;
return f;
}
...@@ -433,7 +433,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) ...@@ -433,7 +433,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
/* Bool ops don't participate in vectorization factor /* Bool ops don't participate in vectorization factor
computation. For comparison use compared types to computation. For comparison use compared types to
compute a factor. */ compute a factor. */
if (TREE_CODE (scalar_type) == BOOLEAN_TYPE if (VECT_SCALAR_BOOLEAN_TYPE_P (scalar_type)
&& is_gimple_assign (stmt) && is_gimple_assign (stmt)
&& gimple_assign_rhs_code (stmt) != COND_EXPR) && gimple_assign_rhs_code (stmt) != COND_EXPR)
{ {
...@@ -442,11 +442,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) ...@@ -442,11 +442,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
mask_producers.safe_push (stmt_info); mask_producers.safe_push (stmt_info);
bool_result = true; bool_result = true;
if (gimple_code (stmt) == GIMPLE_ASSIGN if (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt))
&& TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison
== tcc_comparison && !VECT_SCALAR_BOOLEAN_TYPE_P
&& TREE_CODE (TREE_TYPE (gimple_assign_rhs1 (stmt))) (TREE_TYPE (gimple_assign_rhs1 (stmt))))
!= BOOLEAN_TYPE)
scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt)); scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
else else
{ {
...@@ -585,9 +584,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) ...@@ -585,9 +584,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
stmt = STMT_VINFO_STMT (mask_producers[i]); stmt = STMT_VINFO_STMT (mask_producers[i]);
if (gimple_code (stmt) == GIMPLE_ASSIGN if (is_gimple_assign (stmt)
&& TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison && TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison
&& TREE_CODE (TREE_TYPE (gimple_assign_rhs1 (stmt))) != BOOLEAN_TYPE) && !VECT_SCALAR_BOOLEAN_TYPE_P
(TREE_TYPE (gimple_assign_rhs1 (stmt))))
{ {
scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt)); scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
mask_type = get_mask_type_for_scalar_type (scalar_type); mask_type = get_mask_type_for_scalar_type (scalar_type);
......
...@@ -3158,9 +3158,7 @@ check_bool_pattern (tree var, vec_info *vinfo, hash_set<gimple *> &stmts) ...@@ -3158,9 +3158,7 @@ check_bool_pattern (tree var, vec_info *vinfo, hash_set<gimple *> &stmts)
break; break;
CASE_CONVERT: CASE_CONVERT:
if ((TYPE_PRECISION (TREE_TYPE (rhs1)) != 1 if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (rhs1)))
|| !TYPE_UNSIGNED (TREE_TYPE (rhs1)))
&& TREE_CODE (TREE_TYPE (rhs1)) != BOOLEAN_TYPE)
return false; return false;
if (! check_bool_pattern (rhs1, vinfo, stmts)) if (! check_bool_pattern (rhs1, vinfo, stmts))
return false; return false;
...@@ -3474,9 +3472,7 @@ search_type_for_mask_1 (tree var, vec_info *vinfo, ...@@ -3474,9 +3472,7 @@ search_type_for_mask_1 (tree var, vec_info *vinfo,
if (TREE_CODE (var) != SSA_NAME) if (TREE_CODE (var) != SSA_NAME)
return NULL_TREE; return NULL_TREE;
if ((TYPE_PRECISION (TREE_TYPE (var)) != 1 if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (var)))
|| !TYPE_UNSIGNED (TREE_TYPE (var)))
&& TREE_CODE (TREE_TYPE (var)) != BOOLEAN_TYPE)
return NULL_TREE; return NULL_TREE;
if (!vect_is_simple_use (var, vinfo, &def_stmt, &dt)) if (!vect_is_simple_use (var, vinfo, &def_stmt, &dt))
...@@ -3518,7 +3514,7 @@ search_type_for_mask_1 (tree var, vec_info *vinfo, ...@@ -3518,7 +3514,7 @@ search_type_for_mask_1 (tree var, vec_info *vinfo,
{ {
tree comp_vectype, mask_type; tree comp_vectype, mask_type;
if (TREE_CODE (TREE_TYPE (rhs1)) == BOOLEAN_TYPE) if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (rhs1)))
{ {
res = search_type_for_mask_1 (rhs1, vinfo, cache); res = search_type_for_mask_1 (rhs1, vinfo, cache);
res2 = search_type_for_mask_1 (gimple_assign_rhs2 (def_stmt), res2 = search_type_for_mask_1 (gimple_assign_rhs2 (def_stmt),
...@@ -3637,9 +3633,7 @@ vect_recog_bool_pattern (vec<gimple *> *stmts, tree *type_in, ...@@ -3637,9 +3633,7 @@ vect_recog_bool_pattern (vec<gimple *> *stmts, tree *type_in,
var = gimple_assign_rhs1 (last_stmt); var = gimple_assign_rhs1 (last_stmt);
lhs = gimple_assign_lhs (last_stmt); lhs = gimple_assign_lhs (last_stmt);
if ((TYPE_PRECISION (TREE_TYPE (var)) != 1 if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (var)))
|| !TYPE_UNSIGNED (TREE_TYPE (var)))
&& TREE_CODE (TREE_TYPE (var)) != BOOLEAN_TYPE)
return NULL; return NULL;
hash_set<gimple *> bool_stmts; hash_set<gimple *> bool_stmts;
...@@ -4023,7 +4017,7 @@ vect_recog_mask_conversion_pattern (vec<gimple *> *stmts, tree *type_in, ...@@ -4023,7 +4017,7 @@ vect_recog_mask_conversion_pattern (vec<gimple *> *stmts, tree *type_in,
/* Now check for binary boolean operations requiring conversion for /* Now check for binary boolean operations requiring conversion for
one of operands. */ one of operands. */
if (TREE_CODE (TREE_TYPE (lhs)) != BOOLEAN_TYPE) if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (lhs)))
return NULL; return NULL;
if (rhs_code != BIT_IOR_EXPR if (rhs_code != BIT_IOR_EXPR
......
...@@ -2949,7 +2949,7 @@ vect_get_constant_vectors (tree op, slp_tree slp_node, ...@@ -2949,7 +2949,7 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
gimple_seq ctor_seq = NULL; gimple_seq ctor_seq = NULL;
/* Check if vector type is a boolean vector. */ /* Check if vector type is a boolean vector. */
if (TREE_CODE (TREE_TYPE (op)) == BOOLEAN_TYPE if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op))
&& vect_mask_constant_operand_p (stmt, op_num)) && vect_mask_constant_operand_p (stmt, op_num))
vector_type vector_type
= build_same_sized_truth_vector_type (STMT_VINFO_VECTYPE (stmt_vinfo)); = build_same_sized_truth_vector_type (STMT_VINFO_VECTYPE (stmt_vinfo));
......
...@@ -1420,7 +1420,7 @@ vect_get_vec_def_for_operand (tree op, gimple *stmt, tree vectype) ...@@ -1420,7 +1420,7 @@ vect_get_vec_def_for_operand (tree op, gimple *stmt, tree vectype)
if (vectype) if (vectype)
vector_type = vectype; vector_type = vectype;
else if (TREE_CODE (TREE_TYPE (op)) == BOOLEAN_TYPE else if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op))
&& VECTOR_BOOLEAN_TYPE_P (stmt_vectype)) && VECTOR_BOOLEAN_TYPE_P (stmt_vectype))
vector_type = build_same_sized_truth_vector_type (stmt_vectype); vector_type = build_same_sized_truth_vector_type (stmt_vectype);
else else
...@@ -2029,7 +2029,7 @@ vectorizable_mask_load_store (gimple *stmt, gimple_stmt_iterator *gsi, ...@@ -2029,7 +2029,7 @@ vectorizable_mask_load_store (gimple *stmt, gimple_stmt_iterator *gsi,
mask = gimple_call_arg (stmt, 2); mask = gimple_call_arg (stmt, 2);
if (TREE_CODE (TREE_TYPE (mask)) != BOOLEAN_TYPE) if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (mask)))
return false; return false;
/* FORNOW. This restriction should be relaxed. */ /* FORNOW. This restriction should be relaxed. */
...@@ -5275,9 +5275,9 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi, ...@@ -5275,9 +5275,9 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi,
of booleans or vector of integers). We use output of booleans or vector of integers). We use output
vectype because operations on boolean don't change vectype because operations on boolean don't change
type. */ type. */
if (TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE) if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op0)))
{ {
if (TREE_CODE (TREE_TYPE (scalar_dest)) != BOOLEAN_TYPE) if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (scalar_dest)))
{ {
if (dump_enabled_p ()) if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
...@@ -7666,7 +7666,7 @@ vect_is_simple_cond (tree cond, vec_info *vinfo, tree *comp_vectype) ...@@ -7666,7 +7666,7 @@ vect_is_simple_cond (tree cond, vec_info *vinfo, tree *comp_vectype)
/* Mask case. */ /* Mask case. */
if (TREE_CODE (cond) == SSA_NAME if (TREE_CODE (cond) == SSA_NAME
&& TREE_CODE (TREE_TYPE (cond)) == BOOLEAN_TYPE) && VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (cond)))
{ {
gimple *lhs_def_stmt = SSA_NAME_DEF_STMT (cond); gimple *lhs_def_stmt = SSA_NAME_DEF_STMT (cond);
if (!vect_is_simple_use (cond, vinfo, &lhs_def_stmt, if (!vect_is_simple_use (cond, vinfo, &lhs_def_stmt,
...@@ -9059,7 +9059,7 @@ get_mask_type_for_scalar_type (tree scalar_type) ...@@ -9059,7 +9059,7 @@ get_mask_type_for_scalar_type (tree scalar_type)
tree tree
get_same_sized_vectype (tree scalar_type, tree vector_type) get_same_sized_vectype (tree scalar_type, tree vector_type)
{ {
if (TREE_CODE (scalar_type) == BOOLEAN_TYPE) if (VECT_SCALAR_BOOLEAN_TYPE_P (scalar_type))
return build_same_sized_truth_vector_type (vector_type); return build_same_sized_truth_vector_type (vector_type);
return get_vectype_for_scalar_type_and_size return get_vectype_for_scalar_type_and_size
......
...@@ -784,6 +784,18 @@ struct dataref_aux { ...@@ -784,6 +784,18 @@ struct dataref_aux {
/* The maximum vectorization factor supported by any target (V64QI). */ /* The maximum vectorization factor supported by any target (V64QI). */
#define MAX_VECTORIZATION_FACTOR 64 #define MAX_VECTORIZATION_FACTOR 64
/* Nonzero if TYPE represents a (scalar) boolean type or type
in the middle-end compatible with it (unsigned precision 1 integral
types). Used to determine which types should be vectorized as
VECTOR_BOOLEAN_TYPE_P. */
#define VECT_SCALAR_BOOLEAN_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == BOOLEAN_TYPE \
|| ((TREE_CODE (TYPE) == INTEGER_TYPE \
|| TREE_CODE (TYPE) == ENUMERAL_TYPE) \
&& TYPE_PRECISION (TYPE) == 1 \
&& TYPE_UNSIGNED (TYPE)))
extern vec<stmt_vec_info> stmt_vec_info_vec; extern vec<stmt_vec_info> stmt_vec_info_vec;
void init_stmt_vec_info_vec (void); void init_stmt_vec_info_vec (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment