From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6005F3858035; Tue, 23 Jan 2024 13:21:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6005F3858035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706016080; bh=bHVII/bpvTcoH05DBgkvhTQIujrOCQf5MgEZqvA/oxo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pcRExrkLBS8cmOuMeAh7OBKfkE0tuFdS2FDlQnXtdILaFf0Q/+6TUWwOcMM1gK8tD nSiwxJm+N07Hp1OgTjz8xMyprhYFmsUXnCIqYnQQ2zriERwxLiaGG0JCoytnHHs1rZ wI4gLi5rgvqYrf0VgFNiRZ8MpaVrqZPaTARgpcUs= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113441] [14 Regression] Fail to fold the last element with multiple loop Date: Tue, 23 Jan 2024 13:21:19 +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: 14.0 X-Bugzilla-Keywords: missed-optimization, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D113441 --- Comment #24 from JuzheZhong --- (In reply to Richard Biener from comment #19) > (In reply to Richard Biener from comment #18) > > (In reply to Tamar Christina from comment #17) > > > Ok, bisected to > > >=20 > > > g:2efe3a7de0107618397264017fb045f237764cc7 is the first bad commit > > > commit 2efe3a7de0107618397264017fb045f237764cc7 > > > Author: Hao Liu > > > Date: Wed Dec 6 14:52:19 2023 +0800 > > >=20 > > > tree-optimization/112774: extend the SCEV CHREC tree with a nonwr= apping > > > flag > > >=20 > > > Before this commit we were unable to analyse the stride of the access. > > > After this niters seems to estimate the loop trip count at 4 and afte= r that > > > the logs diverge enormously. > >=20 > > Hum, but that's backward and would match to what I said in comment#2 - = we > > should get better code with that. > >=20 > > Juzhe - when you revert the above ontop of trunk does the generated code > > look better for Risc-V? >=20 > It doesn't revert but you can do >=20 > diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc > index 25e3130e2f1..7870c8d76fb 100644 > --- a/gcc/tree-scalar-evolution.cc > +++ b/gcc/tree-scalar-evolution.cc > @@ -2054,7 +2054,7 @@ analyze_scalar_evolution (class loop *loop, tree va= r) >=20=20 > void record_nonwrapping_chrec (tree chrec) > { > - CHREC_NOWRAP(chrec) =3D 1; > + CHREC_NOWRAP(chrec) =3D 0; >=20=20 > if (dump_file && (dump_flags & TDF_SCEV)) > { Hmmm. With experiments. The codegen looks slightly better but still didn't recover back to GCC-12. Btw, I compare ARM SVE codegen, even with cost model: https://godbolt.org/z/cKc1PG3dv I think GCC 13.2 codegen is better than GCC trunk with cost model.=