From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C516C384D15A; Thu, 6 Oct 2022 06:05:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C516C384D15A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665036350; bh=fqPFTz4DYTFIndsG9Z7nl2Bs5OFD8q1FP13SEiQdWps=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hW0R88WSV4JPU4rttNntZRdkP6WyZ7SFVFaa+n3bNMQ/10Hf+iniHswLobVcAJOPq hp03+3BDKE4IVOQBhadxE2h8CMzMwlvpUe9YlgE/XSmTymts3rONtUH+5YXxMbHQbx NrHXUkrg3jEciGT2BAMhKuZQEecUD8Ebuomwov3w= From: "unlvsur at live dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/107167] It looks like GCC wastes registers on trivial computations when result can be cached Date: Thu, 06 Oct 2022 06:05:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: unlvsur at live dot com 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: 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=3D107167 --- Comment #4 from cqwrteur --- (In reply to Andrew Pinski from comment #1) > Plus your example might be slower due to dependencies. Dependency is only an issue to a certain degree. 1st one it has things like "movl %edi, %edx; rorl $11, %edx" which is also a flow dependency. CPU solves flow dependency to a very large degree with register forwarding. Write dependencies are also dealt with register renaming if we save registe= rs, register renaming will also save time.=