From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C7FD3383B82C; Tue, 27 Jul 2021 23:09:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7FD3383B82C From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101653] [9/10/11/12 Regression] Bad code generated when optimizing nested for loops Date: Tue, 27 Jul 2021 23:09:33 +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: 11.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 9.5 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: Tue, 27 Jul 2021 23:09:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101653 --- Comment #2 from Andrew Pinski --- Confirmed, ivcannon is turning the loops into: [local count: 79093198]: goto ; [100.00%] [local count: 357878150]: a_8 =3D a_11 + 1; c_14 =3D c_3 + 2; goto ; [100.00%] [local count: 79093198]: # _5 =3D PHI <123(6)> return _5; [local count: 375401868]: # c_3 =3D PHI <1(2), c_14(4)> # a_11 =3D PHI <0(2), a_8(4)> # ivtmp_20 =3D PHI <2(2), ivtmp_1(4)> c_6 =3D c_3 + 1; ivtmp_1 =3D ivtmp_20 - 1; if (ivtmp_1 =3D=3D 0) goto ; [5.50%] else goto ; [94.50%] Removing all of the if conditions on c < a and turning it into true ...=