From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DCC5F385840E; Mon, 20 Sep 2021 08:42:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCC5F385840E From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102391] Failure to optimize adjacent 8-bit loads into a single bigger load Date: Mon, 20 Sep 2021 08:42:58 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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: --- 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 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, 20 Sep 2021 08:42:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102391 --- Comment #3 from Richard Biener --- the bswap pass is in principle able to handle these but it sees _1 =3D (sizetype) offset_12(D); _2 =3D RomHeader_13(D) + _1; _3 =3D *_2; _4 =3D (signed short) _3; _5 =3D _1 + 1; _6 =3D RomHeader_13(D) + _5; _7 =3D *_6; so the constant offset is not forwarded to the MEM_REFs (int vs. size_t iss= ue) and the bswap pass doesn't perform any fancy dataref analysis to spot constant offsetted same bases (it could simply use split_constant_offset on the found base I guess or invoke DR analysis in BB mode).=