From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 29FC33858415; Thu, 29 Jun 2023 12:07:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29FC33858415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688040432; bh=GHXA7y5uCJqbxi3Wduul6gA6qpCd5C/cKA2w9smrwhE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X0xCPJZkpc6MglMHyjywJ8VN+l5i2bbP6537CjkaYy5l2B1pH/ufqZP69gfJWFU50 1IGHokrKI0YkGmsJ36KPfu6ykvnU7HaIk+aqizKjxtJ8SPKtCeMItpnDN4GKzdPLtU XoAjNRevuYLEyIEmYajcEdVQri7qPUdjAhnk09ac= From: "chenglulu at loongson dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110484] Spec2017 541 after adding the '-flto-fomit-frame-pointer' optimization, after optimizing the rnreg, directly replaced other registers with the $r22 register, so that the value of the $r22 register was destroyed without being saved. Date: Thu, 29 Jun 2023 12:07:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: chenglulu at loongson dot cn 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=3D110484 --- Comment #1 from chenglulu --- The following code modification problem can be solved=EF=BC=9A --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -1112,7 +1112,9 @@ loongarch_first_stack_step (struct loongarch_frame_in= fo *frame) static void loongarch_emit_stack_tie (void) { - emit_insn (gen_stack_tie (Pmode, stack_pointer_rtx, hard_frame_pointer_rtx)); + emit_insn (gen_stack_tie (Pmode, stack_pointer_rtx, + frame_pointer_needed ? hard_frame_pointer_rtx + : stack_pointer_rtx)); }=