From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0BABE38316DA; Tue, 2 May 2023 20:13:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BABE38316DA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683058408; bh=LUUrbPCI6A9WlRxlFQh0vba0jumYCRI62UW95S/XAhc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CEusd12BDrJt4Vrb6knCXtwW1Hq0PdvSUL1/tv2BEX/hjgU3U+a+qQdxVE2kPL9nz NA5auzBXGJ1JgEjSqaWgxitwWH9VNs7WQxcvxhsqArxFIyoGOLmkqnZb0NVc8dDLcU N15/mAreAa6civiSW6x1H+0lm2E2bqDZ4d9ipcSI= 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: Tue, 02 May 2023 20:13:27 +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 #10 from CVS Commits --- The releases/gcc-11 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:e7496d6571624547b52264b80469bd071217ae02 commit r11-10697-ge7496d6571624547b52264b80469bd071217ae02 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, optimize_vectors_before_lowering_p): Defi= ne 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)=