From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B767385842A; Thu, 11 Apr 2024 14:28:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B767385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712845710; bh=tnUUOcVWAhUzeX0d5NJqDnN3c5+ItBprWQemJ+wmQis=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mDPxBiQ06kOchR05IfBxXLDxbpuMrJW26Vn+43vuNG5wDR4dBloP8G0cXDcWFzkLs Gynn2z2DH66YeYuonjAU5PGvQrRCC3w38gcGt2lrxrfdlXeKIgwoAxUkzD/mDf1yaI s3laXmI4N+EQg0VDTV2Nvdvx3SfzH68hzfuobJA8= From: "rearnsha 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 14:28:19 +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: rearnsha 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: 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=3D111231 Richard Earnshaw changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #21 from Richard Earnshaw --- With my new testcase, compiled on an arm-none-eabi cross with=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-con= stants -fmath-errno -fno-exceptions The critical sequence, at the end of gimple optimization is: v =3D b; MEM [(char * {ref-all})&D.33805] =3D MEM [(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; This generates the following (pseudo) rtl: ; 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 The two key instructions have been starred.=20 Things proceed OK until sched2, at which point, when building the dependenc= ies, we fail to create a link between i119 and i120. I've tracked 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 cle= ar to me why we've tracked back to the copy before the load of interest, nor w= hy, at this point, we're looking at tree addressability to decide whether or not there are memory dependencies here.=