From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A1C01385703A; Fri, 10 Jul 2020 07:19:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1C01385703A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594365575; bh=HUb0x1x3kVnnxioebKpvgGvqvzL2QPEojArSj+P+Frg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=txVBlOnJ5NzVNaWy0TA5FARjSSqSVAOHYsxcCqYvismobmya32jouuCSdP2BHvL/K oU1iJq7fSoFhwDLfrpAnDnvud1ZBlZEnLxsCKCeO64lrcMEpmdcxplOZu7cHZdzwZq a3ce/Oy2R7k/nwSEHowjfDSKViM0cWaLYgCkaJrs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/96135] [9/10/11 regression] bswap not detected by bswap pass, unexpected results between optimization levels Date: Fri, 10 Jul 2020 07:19:35 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: 9.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on keywords target_milestone everconfirmed priority 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: Fri, 10 Jul 2020 07:19:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96135 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-07-10 Keywords| |missed-optimization Target Milestone|--- |9.4 Ever confirmed|0 |1 Priority|P3 |P2 --- Comment #1 from Richard Biener --- The bswap pass doesn't handle these patterns at all (it doesn't look at stores). What does handle this case is store-merging which - on trunk - figures bswap in f() but not in g() likely because of the BIT_FIELD_REF -> cast folding which makes the stores appear inhomogenous: _3 =3D VIEW_CONVERT_EXPR(x_2(D)); _4 =3D BIT_FIELD_REF ; v.c[0] =3D _4; ... _11 =3D (char) _3; v.c[7] =3D _11; store-merging already handles the cast vs. BIT_FIELD_REF case for f() but it appearantly doesn't consider to look through a VIEW_CONVERT. With -O3 we vectorize this in an inconvenient way and fully elide the store so store-merging isn't the correct pass to handle this: _3 =3D BIT_FIELD_REF ; _4 =3D BIT_FIELD_REF ; _5 =3D BIT_FIELD_REF ; _6 =3D BIT_FIELD_REF ; _7 =3D BIT_FIELD_REF ; _8 =3D BIT_FIELD_REF ; _9 =3D BIT_FIELD_REF ; _10 =3D (char) i_2(D); _21 =3D {_3, _4, _5, _6, _7, _8, _9, _10}; _18 =3D VIEW_CONVERT_EXPR(_21); v =3D{v} {CLOBBER}; return _18; the vectorizer is also confused about BIT_FIELD_REF vs. cast here (I repeatedly thought of removing that simplification ... but the user could have written it as well :/). And it would look for a vector function argument but that's something that could be fixed. The above is all for GCC 10. GCC 8 possibly was lucky and did not have that BIT_FIELD_REF -> cast simplification.=