From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C118385842D; Mon, 1 Nov 2021 11:13:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C118385842D From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/103006] [9/10/11/12 Regression] wrong code at -O1 or -O2 on x86_64-linux-gnu by r7-7101 Date: Mon, 01 Nov 2021 11:13:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: ra, 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: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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, 01 Nov 2021 11:13:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103006 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |matz at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- Doesn't look to me like RA issue, but rather incorrect coalescing of tempor= ary vars. Optimized dump has: [local count: 1652516]: ivtmp.40_47 =3D (unsigned long) &h; _30 =3D ivtmp.40_47 + 96; [local count: 13370357]: # ivtmp.40_38 =3D PHI _21 =3D (void *) ivtmp.40_38; MEM[(long int *)_21] =3D 1; MEM[(long int *)_21 + 8B] =3D 1; ivtmp.40_44 =3D ivtmp.40_38 + 16; if (_30 !=3D ivtmp.40_44) goto ; [89.00%] else goto ; [11.00%] [local count: 1652516]: h =3D{v} {CLOBBER}; [local count: 13370357]: # ivtmp.30_29 =3D PHI _31 =3D (void *) ivtmp.30_29; MEM[(long int *)_31] =3D 1; MEM[(long int *)_31 + 8B] =3D 1; ivtmp.30_48 =3D ivtmp.30_29 + 16; if (_30 !=3D ivtmp.30_48) goto ; [89.00%] else goto ; [11.00%] [local count: 1652516]: f =3D 2; e =3D 6; c =3D 1; b =3D &d; d[6] =3D &d; ff (); d =3D{v} {CLOBBER}; _5 =3D h[3][0]; _18 =3D (int) _5; h =3D{v} {CLOBBER}; return _18; So, the code initializes the whole h array, then has h =3D{v} {CLOBBER};, t= hen initializes it again, but unfortunately without mentioning the var in the I= L - it reuses ivtmp.40_47 for that, then sets various vars, including d[6] initialization with &d escaping, clobbers d, reads from h and finally clobb= ers h again. I guess the var partitioning code from the above thinks h isn't really live in between the first h clobber and h[3][0] load and so decides: Partition 0: size 96 align 16 h d and places both h and d into the same stack slot.=