From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 788A6385841A; Sat, 16 Oct 2021 07:35:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 788A6385841A From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102794] [12 Regression] missing vrp in evrp dealing with casts and ands Date: Sat, 16 Oct 2021 07:35:51 +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: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: 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: Sat, 16 Oct 2021 07:35:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102794 --- Comment #3 from Andrew Pinski --- (In reply to Aldy Hernandez from comment #2) > I haven't looked at this, but there's a pending patch with more > restrictions for loop threading in the presence of loops. Does this help? >=20 > https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581637.html >=20 > We really shouldn't be destroying loop info. Yes I think it does, though I have not tried it. There was a jump threading here: : if (d_10 !=3D 0) goto ; [INV] else goto ; [INV] : foo (); : a_12 =3D a_3 + 1; : ;;; loop header # a_3 =3D PHI <-100(2), a_12(6)> if (a_3 !=3D 0) goto ; [INV] else goto ; [INV] where d_10 is defined as: d_10 =3D (short unsigned int) a_3; So yes blocking jumping through the loop header would help. It is very similar to your f3 in ssa-thread-invalid.c testcase.=