From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C17A83939C2E; Mon, 3 May 2021 07:41:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C17A83939C2E From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100363] gcc generating wider load/store than warranted at -O3 Date: Mon, 03 May 2021 07:41:30 +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: 10.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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, 03 May 2021 07:41:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100363 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #9 from Richard Biener --- (In reply to Linus Torvalds from comment #8) > (In reply to Alexander Monakov from comment #7) > >=20 > > Most likely the issue is that sout/sfrom are misaligned at runtime, whi= le > > the vectorized code somewhere relies on them being sufficiently aligned= for > > a 'short'. >=20 > They absolutely are. >=20 > And we build the kernel with -Wno-strict-aliasing exactly to make sure the > compiler doesn't think that "oh, I can make aliasing decisions based on t= ype > information". >=20 > Because we have those kinds of issues all over, and we know which > architectures support unaligned loads etc, and all the tricks with > "memcpy()" and unions make for entirely unreadable code. >=20 > So please fix the aliasing logic to not be type-based when people explici= tly > tell you not to do that. >=20 > Linus Note alignment has nothing to do with strict-aliasing (-fno-strict-aliasing= you mean btw). One thing we do is (I'm not 50% sure this explains the observed issue) assu= me that if you have two accesses with type 'short' and they are aligned according to this type then they will not partly overlap. Note this has nothing to do with C strict aliasing rules but is basic pointer math when you know lower zero bits. I suggest to try the fix suggested in comment#7 and report back if that fixes the observed issue.=