From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 21D773858CDA; Fri, 6 Sep 2024 09:23:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21D773858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1725614587; bh=n4Ec6oktKHzHmSw7qiVN1jq7A4i8Unx67NYSRffL/7o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fkWBJ2gMm/3bxths2H/1616xloxNpzdorul/lGCBOcXrpbRHCPMvsjXnAHiI0dKJc lTS+R7+NKrx1iowpcQ1aTe6Y6FhuTnGlLVhkmbRp3m5Rf8qRRe081ablNoFIhbymF+ IadvYk7CFtzHyd3I9GUkohbMSgH7hXM57i6O8JUA= From: "jschmitz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/116569] [15 Regression] ICE in to_constant, at poly-int.h:592 Date: Fri, 06 Sep 2024 09:23:06 +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: 15.0 X-Bugzilla-Keywords: aarch64-sve, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jschmitz at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jschmitz at gcc dot gnu.org X-Bugzilla-Target-Milestone: 15.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=3D116569 --- Comment #5 from Jennifer Schmitz --- I looked into the issue and summarize below what I found: My current fix that checks for the support of the mod optab for vectors loo= ks like this: @@ -894,7 +894,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* X - (X / Y) * Y is the same as X % Y. */ (simplify (minus (convert1? @0) (convert2? (mult:c (trunc_div @@0 @@1) @1))) - (if (INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) + (if (INTEGRAL_TYPE_P (type) + || (VECTOR_INTEGER_TYPE_P (type) + && target_supports_op_p (type, TRUNC_MOD_EXPR, optab_vector))) (convert (trunc_mod @0 @1)))) However, the test fold-minus-1.c fails, because the simplification is not applied anymore: /* { dg-options "-O -fdump-tree-gimple" } */ void f(vec*x,vec*y){ *x -=3D *x / *y * *y; } /* { dg-final { scan-tree-dump-times "%" 1 "gimple"} } */ /* { dg-final { scan-tree-dump-not "/" "gimple"} } */ I looked into applying the simplification in early tree passes only instead= of checking for support of the mod optab and found functions like optimize_vectors_before_lowering_p that use the PROP_gimple_xxx macros (in tree-pass.h) as mask. I tried different PROP_xxx macros and all tests (fold-minus-1.c; the minimal testcase Kyrill posted that produced the ICE; and my previous vect-mod test= s) run successfully for @@ -896,7 +896,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (minus (convert1? @0) (convert2? (mult:c (trunc_div @@0 @@1) @1))) (if (INTEGRAL_TYPE_P (type) || (VECTOR_INTEGER_TYPE_P (type) - && target_supports_op_p (type, TRUNC_MOD_EXPR, optab_vector))) + && (!cfun || (cfun->curr_properties & PROP_gimple_any) =3D=3D 0))) (convert (trunc_mod @0 @1)))) But I don't think that the PROP_gimple_any is exactly what I want, but I haven't found anything that fits perfectly. Any advise on how to proceed?=