From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B9F9385801B; Wed, 10 Nov 2021 10:13:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B9F9385801B From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102906] [12 regression] gcc.target/arm/ivopts-4.c fails since r12-4526 Date: Wed, 10 Nov 2021 10:13:49 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: aldyh at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2021 10:13:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102906 --- Comment #17 from rguenther at suse dot de --- On Wed, 10 Nov 2021, aldyh at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102906 >=20 > --- Comment #16 from Aldy Hernandez --- > (In reply to rguenther@suse.de from comment #15) > > On Wed, 10 Nov 2021, aldyh at gcc dot gnu.org wrote: >=20 > > > @@ -60,6 +63,24 @@ should_duplicate_loop_header_p (basic_block header= , class > > > loop *loop, > > > if (optimize_loop_for_size_p (loop) > > > && !loop->force_vectorize) > > > { > > > + if (gcond *last =3D safe_dyn_cast (last_stmt (header= ))) > > > + { > > > + gimple_ranger ranger; > > > + int_range<2> r; > > > + path_range_query path (ranger, /*resolve=3D*/true); > > > + auto_vec bbs (2); > > > + edge e =3D loop_preheader_edge (loop); > > > + > > > + gcc_checking_assert (e->dest =3D=3D header); > > > + bbs.quick_push (header); > > > + bbs.quick_push (e->src); > > > + bitmap imports =3D ranger.gori ().imports (header); > > > + path.compute_ranges (bbs, imports); > > > + path.range_of_stmt (r, last); > > > + r.dump (); > > > + fputc ('\n', stderr); > >=20 > > Nice. Does composing the path from the exact two BBs mean that > > it won't pick up a case like > >=20 > > if (n > 0) > > if (k > 0) > > for (; n > 0;) > > ... > >=20 > > where the n > 0 outer condition is on the predecessor from > > e->src? Or is the path merely built to denote the fact > > that we're interested on the entry edge of the loop only > > (on the backedge the condition wouldn't be known)? >=20 > If the predecessor for e->src dominates it, it will also pick that up. T= he > path merely denotes the blocks we care about for intra-block ranges / > relationals, etc. With resolve=3Dtrue (above), any range or relation not= known > within the path we will just pick up the range on entry to the path by as= king > ranger. >=20 > Does that answer your question? Yes. I guess it would be nice to have a CTOR or so for the case where the path is really a single edge like in this case. > For the record, I also agree that we should pull out these loop rotations, > peels, etc from the threaders into the loop optimizers, as they have a be= tter > model to make decisions about loops. Indeed.=