From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 14C9F388300F; Wed, 3 May 2023 15:20:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14C9F388300F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683127233; bh=WcKvNc3Ml58jIhr5IK4VDCoI2eRFzAoWs7QUyE6gbH4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H+VNC1KcqUy1tPVS2YAVzZnmv1XJOjmfl2/574dKVZ+9Dlh7JBBeKMninixdRzjIV C14hkqvHlUGSFz7JsixGa+He7kse4H2sTV5u6SEGKPlnEtO5yuWGdEsUNHPoOZWXbM XB4DAlKiyT33Smm4H2HSYE1yuBt9TdpVOgErU9+Y= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108237] [13 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:281 at -O since r13-1085-g90467f0ad649d081 Date: Wed, 03 May 2023 15:20:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub 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=3D108237 --- Comment #11 from CVS Commits --- The releases/gcc-10 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a91ca4212faca201291633a8016c5c47dbba07e2 commit r10-11354-ga91ca4212faca201291633a8016c5c47dbba07e2 Author: Jakub Jelinek Date: Wed Jan 4 10:54:38 2023 +0100 generic-match-head: Don't assume GENERIC folding is done only early [PR108237] We ICE on the following testcase, because a valid V2DImode !=3D comparison is folded into an unsupported V2DImode > comparison. The match.pd pattern which does this looks like: /* Transform comparisons of the form (X & Y) CMP 0 to X CMP2 Z where ~Y + 1 =3D=3D pow2 and Z =3D ~Y. */ (for cst (VECTOR_CST INTEGER_CST) (for cmp (eq ne) icmp (le gt) (simplify (cmp (bit_and:c@2 @0 cst@1) integer_zerop) (with { tree csts =3D bitmask_inv_cst_vector_p (@1); } (if (csts && (VECTOR_TYPE_P (TREE_TYPE (@1)) || single_use (@2))) (with { auto optab =3D VECTOR_TYPE_P (TREE_TYPE (@1)) ? optab_vector : optab_default; tree utype =3D unsigned_type_for (TREE_TYPE (@1)); } (if (target_supports_op_p (utype, icmp, optab) || (optimize_vectors_before_lowering_p () && (!target_supports_op_p (type, cmp, optab) || !target_supports_op_p (type, BIT_AND_EXPR, optab= )))) (if (TYPE_UNSIGNED (TREE_TYPE (@1))) (icmp @0 { csts; }) (icmp (view_convert:utype @0) { csts; }))))))))) and that optimize_vectors_before_lowering_p () guarded stuff there already deals with this problem, not trying to fold a supported compari= son into a non-supported one. The reason it doesn't work in this case is t= hat it isn't GIMPLE folding which does this, but GENERIC folding done during forwprop4 - forward_propagate_into_comparison -> forward_propagate_into_comparison_1 -> combine_cond_expr_cond -> fold_binary_loc -> generic_simplify and we simply assumed that GENERIC folding happens only before gimplification. The following patch fixes that by checking cfun properties instead of always returning true in those cases. 2023-01-04 Jakub Jelinek PR middle-end/108237 * generic-match-head.c: Include tree-pass.h. (canonicalize_math_p): Define to false if cfun and cfun->curr_properties has PROP_gimple_opt_math resp. PROP_gimple_lvec property set. * gcc.c-torture/compile/pr108237.c: New test. (cherry picked from commit 345dffd0d4ebff7e705dfff1a8a72017a167120a)=