From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 16240385840C; Thu, 11 Apr 2024 18:25:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16240385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712859925; bh=PNoR/1J5eKt5HFb1tzDOn4wCB2dd1PuRlvnkxffRnqw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Klafs4OWQ5N7LuPS9n6Jhe0gyZLk0o3gvt26aBsRQJjfaAYFN2UorLgFUPYqyrH0F AFd8mRI4FI3TseVfK9xm+xKpn3s7DJMXDIq4q/DhzIZKX/ZDLBpEhuH94E7e53Cn7g pxQYr4ZXjqFHjmfBUGppcmdUtoruUq4D2/ktYuXg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111231] [12/13/14 regression] armhf: Miscompilation with -O2/-fno-exceptions level (-fno-tree-vectorize is working) Date: Thu, 11 Apr 2024 18:25:22 +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: 13.2.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: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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=3D111231 --- Comment #24 from Andrew Pinski --- (In reply to Richard Earnshaw from comment #21) > With my new testcase, compiled on an arm-none-eabi cross with=20 >=20 > cc1plus ../hwy-pr111231-cpp.cc -mfpu=3Dneon-vfpv4 -mfloat-abi=3Dhard > -mfp16-format=3Dieee -marm -mlibarch=3Darmv7-a+neon-vfpv4 > -march=3Darmv7-a+neon-vfpv4 -O2 -fPIE -fvisibility=3Dhidden > -fvisibility-inlines-hidden -fmerge-all-constants -fmath-errno > -fno-exceptions >=20 > The critical sequence, at the end of gimple optimization is: >=20 > v =3D b; > MEM [(char * {ref-all})&D.33805] =3D MEM char[16]> [(char * {ref-all})&v]; > v =3D{v} {CLOBBER(eol)}; > v =3D D.33805; > vect__239.652_700 =3D MEM [(short int *)&v]; > vect__240.653_702 =3D vect__239.652_700 << 8; >=20 > This generates the following (pseudo) rtl: >=20 > ; D.33805 =3D _179 > 113: r215:SI=3Dr109:SI-0x10 > 114: {r0:SI..r3:SI} =3D [r215:SI (0 MEM [(char * > {ref-all})_179]+0 S4 A64)] > 112: r214:SI=3Dr109:SI-0x60 > 115: [r214:SI (0 MEM [(char * {ref-all})&D.33805]+0= S4 > A64)] =3D {r0:SI..r3:SI} > ; _179 =3D D.33805 > 117: r217:SI=3Dr109:SI-0x60 > 118: {r0:SI..r3:SI} =3D [r217:SI (2 D.33805+0 S4 A64)] > 116: r216:SI=3Dr109:SI-0x10 > * 119: [r216:SI (2 MEM[(struct Vec128 *)_179]+0 S4 A64)] =3D > {r0:SI..r3:SI} > ; r218 =3D _179 > * 120: r218:V8HI=3D[r109:SI-0x10 (3 MEM [(short int > *)_179]+0 S16 A64)] > 121: r178:V8HI=3Dunspec[r218:V8HI,const_vector] 451 >=20 > The two key instructions have been starred.=20 >=20 > Things proceed OK until sched2, at which point, when building the > dependencies, we fail to create a link between i119 and i120. I've track= ed > this as far as ptr_deref_may_alias_decl_p (), where the call to > may_be_aliased () decides that D.33805 cannot be aliased and thus there's= no > dependency. But it's not clear to me why we've tracked back to the copy > before the load of interest, nor why, at this point, we're looking at tree > addressability to decide whether or not there are memory dependencies her= e. This making it sound like one of the -fstack-reuse=3D issues (see the linke= d bug reports from PR 111843). Does -fstack-reuse=3Dnone help?=