From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 43BDA386182A; Tue, 25 Jun 2024 12:46:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43BDA386182A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719319584; bh=evSEXiEEwWDS0lqRq82AQrc2oUufxBTc+ii8ZCblcv4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M7j+OfRuqKbq8DMFchrd+MWrA30muaWmHn4gtHoFvSBDxK+omK3A0R8Cx/peiyy14 IdCuCqv0K3ThR20ErsaLt+vIGHdTEVqQ+TPWTO1NIHMvddz5riSyphshTX3AT2/rOp PkUiLcJtrwMIavVdwtopOsrG87ubouUnaqURfTNk= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115120] Bad interaction between ivcanon and early break vectorization Date: Tue, 25 Jun 2024 12:46:23 +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 X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D115120 --- Comment #6 from Richard Biener --- (In reply to Tamar Christina from comment #5) > considering ivopts bails out on doloop prediction for multiple exits anyw= ay, > what do you think about: >=20 > diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc > index 5ef24a91917..d1b25ad7dea 100644 > --- a/gcc/tree-ssa-loop-ivcanon.cc > +++ b/gcc/tree-ssa-loop-ivcanon.cc > @@ -1319,7 +1319,8 @@ canonicalize_loop_induction_variables (class loop > *loop, >=20 > if (create_iv > && niter && !chrec_contains_undetermined (niter) > - && exit && just_once_each_iteration_p (loop, exit->src)) > + && exit && just_once_each_iteration_p (loop, exit->src) > + && (single_dom_exit (loop) || targetm.predict_doloop_p (loop))) > { > tree iv_niter =3D niter; > if (may_be_zero) >=20 > richi? I think while IVOPTs might not care, loop-doloop.cc handles multiple exists just fine I think. What about moving iv_canon towards iv_optimize? Ideally it would be integrated with IVOPTs itself, but that can be done later. In particular I wonder which other passes might depend on iv_canon being run early (yeah, it also elides single-iteration loops, so maybe you need to "split" it)=