From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B0EE3858C48; Tue, 11 Jun 2024 09:48:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B0EE3858C48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718099293; bh=qc88BlEhN+k3pjZaOOY3XnUe3PgFHdNTgOTRQ+Kwlv4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IQzIW/8RCymgnYJHUZzJb64lts0EpJMJHkHQSv2gcQrrd2Ts7c1RqsRTfJhClHlRt 2z4DFuU0YDVqDDruf/jDUMbfRQy5tlpRXJLkMW8Upx4RLIeYkp1gO3Tf4kfA18PxPY 91ImFgS1yd1UoZ9sGE+EBc6F743AJlo5gzw6KO2M= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115423] Inlined strcmp optimizes poorly Date: Tue, 11 Jun 2024 09:48:08 +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: unknown 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115423 --- Comment #2 from Richard Biener --- You could also say rtl-optimization does a bad job with the inlined version. Or we should inline strcmp on GIMPLE to get the first char optimized. Consider strcmp (c, "ABCDEFGHabcdefgh") || strcmp (c, "ABCDEFGHfoobar") thus strings with a common prefix which we could optimize as strncmp (c, "ABCDEFGH", 8) && (strcmp (c+8, "abcdefgh") || strcmp (c+8, "foobar")) as a more general transform. I should say inline_string_cmp should consider using larger unaligned reads as well.=