From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A06F63858D38; Mon, 30 Oct 2023 20:21:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A06F63858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698697307; bh=2zfWG7Q5agKKFGAA4dVUHV7Mq10GkZaeY+Gzng4yaK8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CTNdYeUw8N6gWA0Mn4C/S0yylzXMBfKxGKhZ+utSgXJaoNdToOAcGWITfKUMYHpTJ co6uroNXn141wYlSxag1DiIMF84ssezyJlRTvl9BqNUURH0HYJFZiHj1XibbYwOJnr 57NRqN9wWZb03JaDF3XnZtTuhypdYmyTO9yPgK+4= From: "avieira at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112282] [14 Regression] wrong code (generated code hangs) at -O3 on x86_64-linux-gnu since r14-4777-g88c27070c25309 Date: Mon, 30 Oct 2023 20:21:47 +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: avieira at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D112282 avieira at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |avieira at gcc dot gnu.org --- Comment #9 from avieira at gcc dot gnu.org --- So I had a look at this and this is as far as I got. It seems to get stuck in the 'for (u =3D -22; u < 2; ++u)' loop. It looks l= ike the loop IV never gets updated and it keeps looping. Looking at the codegen it seems that cunroll decides to remove A LOT of code and there is now: bb 4: .. # ivtmp_1055 =3D PHI .. bb 24: ... ivtmp_1056 =3D ivtmp_1055 - 1; goto ; [100.00%] I've not yet been able to figure out why this happens, the dumps weren't ve= ry helpful. So I tried -fdisable-tree-cunroll, it was still failing. So I look= ed at the dumps to try and see what was turning this loop into an infinite loop and vrp2 shows me: Global Exported: _19 =3D [irange] int [-21, 0] Folding predicate _19 !=3D 2 to 1 and in the dump before vrp2 we see: [local count: 7354175]: # u.13_485 =3D PHI <_19(105), -22(3)> # u_lsm.72_510 =3D PHI <_19(105), _497(D)(3)> # u_lsm_flag.73_235 =3D PHI <1(105), 0(3)> ... [local count: 6634488]: al =3D{v} {CLOBBER(eol)}; _19 =3D u.13_485 + 1; if (_19 !=3D 2) goto ; [96.34%] else goto ; [3.66%] [local count: 6391666]: goto ; [100.00%] Something to point out here, that u_lsm.72_510 seems odd. It is used to set global 'u', but its initialized with _497(D) which is undefined... So that itself seems wrong to me too... I'll try and find out what's causing that codegen next. Maybe that can explain why the irange for _19 is so wrong her= e.=