From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A9BD3858D28; Mon, 18 Jul 2022 15:45:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A9BD3858D28 From: "rearnsha at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106187] armhf: Miscompilation at O2 level (O0 / O1 are working) Date: Mon, 18 Jul 2022 15:45:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.4.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rearnsha 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: --- 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 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: Mon, 18 Jul 2022 15:45:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106187 Richard Earnshaw changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #26 from Richard Earnshaw --- git bisect points to commit r11-9688 resolving the issue. Before that comm= it the ivopts pass generates: ivtmp.761_217 =3D (unsigned int) &au; _222 =3D &bu + 4; ivtmp.767_220 =3D (unsigned int) _222; _225 =3D (unsigned int) &au; _228 =3D _225 + 16; [local count: 858993457]: # prephitmp_136 =3D PHI # prephitmp_32 =3D PHI # ivtmp.761_278 =3D PHI # ivtmp.767_218 =3D PHI _16 =3D prephitmp_32 ^ prephitmp_136; _223 =3D (void *) ivtmp.761_278; MEM[(unsigned int *)_223] =3D _16; ivtmp.761_216 =3D ivtmp.761_278 + 4; if (ivtmp.761_216 !=3D _228) goto ; [75.00%] else goto ; [25.00%] [local count: 644245086]: _230 =3D (void *) ivtmp.761_216; pretmp_120 =3D MEM[(unsigned int *)_230]; _229 =3D (void *) ivtmp.767_218; pretmp_18 =3D MEM[(unsigned int *)_229]; ivtmp.767_219 =3D ivtmp.767_218 + 4; goto ; [100.00%] And once that patch is applied we get: ivtmp.761_217 =3D (unsigned int) &au; ivtmp.766_220 =3D (unsigned int) &bu; _223 =3D (unsigned int) &au; _225 =3D _223 + 16; [local count: 858993457]: # prephitmp_136 =3D PHI # prephitmp_32 =3D PHI # ivtmp.761_278 =3D PHI # ivtmp.766_218 =3D PHI _16 =3D prephitmp_32 ^ prephitmp_136; _222 =3D (void *) ivtmp.761_278; MEM[(unsigned int *)_222] =3D _16; ivtmp.761_216 =3D ivtmp.761_278 + 4; if (ivtmp.761_216 !=3D _225) goto ; [75.00%] else goto ; [25.00%] The main difference being that in the 'bad' code we start with &bu + 4, whi= le in the good code we start with &bu. I'm afraid I don't know enough about this code to take this further. Richi= ?=