From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 73CE43858C98; Mon, 22 Apr 2024 09:09:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73CE43858C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713776999; bh=+trYEoaAJ0x/lUUDEGSumhV6ZgtFFDM5gqL84lJvJT0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LvxcY8YZKpfiS+mjOVBYT12ElxCy+Q3TI9uD26LPDUuzlanGywmsiNrwyI9XKvL77 jT4gaLpgH8uoPzqjdy5tvN8T5aEfmYP1farsb46gKtfmEgPfLK2dz5nttXk7wNy3BY QVGafclYHHZOWHEcSWtS1ffJM8h+ucnjfNzh4kKw= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114787] [13/14 Regression] wrong code at -O1 on x86_64-linux-gnu (the generated code hangs) Date: Mon, 22 Apr 2024 09:09:57 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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=3D114787 --- Comment #11 from Jakub Jelinek --- Seems it is {,likely_}max_loop_iterations_int on the for (; i < 1; i++) loop which matters (aka loop 3). Given the i =3D 0 right before it (guess csmit= h-ism, don't see why it couldn't be in the for init expression) it estimates that = it loops once. Then the copyprop2 pass removes the i++ latch and i <=3D 0 comparison in th= at loop header, so from all I can see that loop disappears. At profile_estimate time, we have loop 1 the b<=3D0 loop which iterates jus= t once and then loop 4 f<=3D0 nested in loop 3 i<=3D0 nested in loop 2 a>=3D0, the= m loop doesn't seem to be in loop structure maybe because of the goto into the loo= p. After copyprop, the loop 1 b<=3D0 is gone and the i<=3D0 loop is as well, b= ut not in the loop structure, loop 3 in the loop structure (presumably with the ca= ched number of loop estimates) has the f<=3D0 header and loop 4 nested in it has= a header testing f<=3D0 too.=