From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 362EF3858C5E; Tue, 21 Mar 2023 09:53:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 362EF3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679392399; bh=xO8InwtWJq0dmE9Y36eEbhWpyAxgPL4PjGv5r0JMYlk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JDrDb5e6qy1mWoKvxhK/dc7PdKd9HVdUETbFeW+eGhgK2ZY3qQ9cfyVikobVM+aQi UgmIEIOwvZIXeZlS1+OYfDmy9Ss7LHIKEz+sV+vrcyGzCXpu/H9zts6nbnidZ7F5AT oYklC8JkaUWidQiSuD40BnPpNqrUe52SYNhoOSn4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109176] [13 Regression] internal compiler error: in to_constant, at poly-int.h:504 Date: Tue, 21 Mar 2023 09:53:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109176 --- Comment #7 from Richard Biener --- (In reply to Jakub Jelinek from comment #5) > Before veclower2 we had/have > _7 =3D ba_5(D) < a_6(D); > _8 =3D svnand_b_z (_7, _7, _7); > _9 =3D VEC_COND_EXPR <_7, _8, _7>; > where _7/_8/_9 are all __SVBool_t. > Before the r11-1445 changes, the VEC_COND_EXPR would be left untouched, > because > expand_vec_cond_expr_p (__SVBool_t, __SVBool_t, SSA_NAME) is true on aarc= h64. > Now it doesn't, because _7 def_stmt is a comparison, and so > expand_vec_cond_expr_p (__SVBool_t, VNx16QI, LT_EXPR). > --- gcc/tree-vect-generic.cc.jj 2023-03-12 22:36:06.356178068 +0100 > +++ gcc/tree-vect-generic.cc 2023-03-20 16:31:03.321831866 +0100 > @@ -1063,6 +1063,12 @@ expand_vector_condition (gimple_stmt_ite > return true; > } >=20=20 > + if (!TYPE_VECTOR_SUBPARTS (type).is_constant () > + && VECTOR_BOOLEAN_TYPE_P (type) > + && VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a)) > + && expand_vec_cond_expr_p (type, TREE_TYPE (a), TREE_CODE (a))) > + return true; > + > /* Handle vector boolean types with bitmasks. If there is a comparison > and we can expand the comparison into the vector boolean bitmask, > or otherwise if it is compatible with type, we can transform > basically restores the behaviour here for the SVE boolean types and makes= it > compile. > Because otherwise, unless this would be solvable by the AVX512 "Handle > vector boolean types with bitmasks." code the non-constant vector elts ca= ses > will always ICE in the following code, int nunits =3D > nunits_for_known_piecewise_op (type); > requires constant TYPE_VECTOR_SUBPARTS and the code really isn't prepared= to > handle anything non-constant. OK, so expand_vec_cond_expr_p does bool expand_vec_cond_expr_p (tree value_type, tree cmp_op_type, enum tree_code c= ode) { machine_mode value_mode =3D TYPE_MODE (value_type); machine_mode cmp_op_mode =3D TYPE_MODE (cmp_op_type); if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type) && get_vcond_mask_icode (TYPE_MODE (value_type), TYPE_MODE (cmp_op_type)) !=3D CODE_FOR_nothi= ng) return true; first. I think vector lowering should always check the original 'a' if it is a mask, like with the following, there's no good reason to special-case this just for VL vectors diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 519a824ec72..c957c9aa7a9 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -1040,6 +1040,10 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) tree_code code =3D TREE_CODE (a); gassign *assign =3D NULL; + if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a)) + && expand_vec_cond_expr_p (type, TREE_TYPE (a), ERROR_MARK)) + return true; + if (code =3D=3D SSA_NAME) { assign =3D dyn_cast (SSA_NAME_DEF_STMT (a)); @@ -1053,14 +1057,14 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) comp_inner_type =3D TREE_TYPE (TREE_TYPE (a1)); comp_width =3D vector_element_bits_tree (TREE_TYPE (a1)); } - } - if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code) - || (integer_all_onesp (b) && integer_zerop (c) - && expand_vec_cmp_expr_p (type, TREE_TYPE (a1), code))) - { - gcc_assert (TREE_CODE (a) =3D=3D SSA_NAME || TREE_CODE (a) =3D=3D VE= CTOR_CST); - return true; + if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code) + || (integer_all_onesp (b) && integer_zerop (c) + && expand_vec_cmp_expr_p (type, TREE_TYPE (a1), code))) + { + gcc_assert (TREE_CODE (a) =3D=3D SSA_NAME || TREE_CODE (a) =3D=3D VECTOR_CST); + return true; + } } /* Handle vector boolean types with bitmasks. If there is a comparison=