From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CFC0E3858401; Mon, 13 Dec 2021 04:56:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFC0E3858401 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95126] [9/10/11/12 Regression] Missed opportunity to turn static variables into immediates Date: Mon, 13 Dec 2021 04:56:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization, needs-bisection X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords bug_severity short_desc target_milestone cf_known_to_work cf_known_to_fail 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, 13 Dec 2021 04:56:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95126 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |needs-bisection Severity|normal |enhancement Summary|Missed opportunity to turn |[9/10/11/12 Regression] |static variables into |Missed opportunity to turn |immediates |static variables into | |immediates Target Milestone|--- |9.5 Known to work| |5.1.0 Known to fail| |5.2.0 --- Comment #2 from Andrew Pinski --- Hmm, in GCC 5.1.0 (and before) we used to produce: mov rdi, QWORD PTR s.1839[rip] jmp func In GCC 5.2.0 and above GCC produces: movzx edi, WORD PTR s.1839[rip+2] movzx edx, WORD PTR s.1839[rip] sal rdi, 16 mov rax, rdi movzx edi, WORD PTR s.1839[rip+4] or rax, rdx sal rdi, 32 or rdi, rax jmp func In both cases, the expander sees: : func (s); [tail call] return; But the expander goes bad. So this has to be a patch which was backported to the GCC 5 branch which ca= used to produce even worse code.=