public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110484] New: 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.
@ 2023-06-29 11:25 chenglulu at loongson dot cn
2023-06-29 12:07 ` [Bug c++/110484] " chenglulu at loongson dot cn
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: chenglulu at loongson dot cn @ 2023-06-29 11:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
Bug ID: 110484
Summary: 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.
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chenglulu at loongson dot cn
Target Milestone: ---
Target: loongarch64-*-linux
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.
Through debugging, it was found that when compiling the SGFTree .cpp file, the
load_from_file function generated the following template in pro_and_epilogue
optimization:
(insn 782 781 783 61 (set (mem:BLK (scratch) [0 A8])
(unspec:BLK [
(reg/f:DI 3 $r3)
(reg/f:DI 22 $r22)
] UNSPEC_TIE)) "SGFTree.cpp":115:1 -1
(nil))
This results in $r22 being present in the load_from_file's reg ever live list
thereafter. However, this is not desirable when the $r22 register is not used
in the function.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [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.
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
@ 2023-06-29 12:07 ` chenglulu at loongson dot cn
2023-06-29 15:33 ` xry111 at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: chenglulu at loongson dot cn @ 2023-06-29 12:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
--- Comment #1 from chenglulu <chenglulu at loongson dot cn> ---
The following code modification problem can be solved:
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -1112,7 +1112,9 @@ loongarch_first_stack_step (struct loongarch_frame_info
*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));
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [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.
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
2023-06-29 12:07 ` [Bug c++/110484] " chenglulu at loongson dot cn
@ 2023-06-29 15:33 ` xry111 at gcc dot gnu.org
2023-09-01 2:04 ` [Bug target/110484] " cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-06-29 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Hmm, I don't quite get the problem. r22 is a saved register, so if it's
clobbered w/o being saved, the issue will be a wrong-code, instead of a
missed-optimization?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/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.
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
2023-06-29 12:07 ` [Bug c++/110484] " chenglulu at loongson dot cn
2023-06-29 15:33 ` xry111 at gcc dot gnu.org
@ 2023-09-01 2:04 ` cvs-commit at gcc dot gnu.org
2023-09-01 2:12 ` chenglulu at loongson dot cn
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-01 2:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by LuluCheng <chenglulu@gcc.gnu.org>:
https://gcc.gnu.org/g:1967f21d000e09d3d3190317af7923b578ce02b1
commit r14-3605-g1967f21d000e09d3d3190317af7923b578ce02b1
Author: Lulu Cheng <chenglulu@loongson.cn>
Date: Thu Jun 29 19:30:59 2023 +0800
LoongArch: Fix bug in loongarch_emit_stack_tie [PR110484].
Which may result in implicit references to $fp when frame_pointer_needed is
false,
causing regs_ever_live[$fp] to be true when $fp is not explicitly used,
resulting in $fp being used as the target replacement register in the rnreg
pass.
The bug originates from SPEC2017 541.leela_r(-flto).
gcc/ChangeLog:
PR target/110484
* config/loongarch/loongarch.cc (loongarch_emit_stack_tie): Use the
frame_pointer_needed to determine whether to use the $fp register.
Co-authored-by: Guo Jie <guojie@loongson.cn>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/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.
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
` (2 preceding siblings ...)
2023-09-01 2:04 ` [Bug target/110484] " cvs-commit at gcc dot gnu.org
@ 2023-09-01 2:12 ` chenglulu at loongson dot cn
2023-09-01 2:43 ` cvs-commit at gcc dot gnu.org
2023-09-01 3:23 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: chenglulu at loongson dot cn @ 2023-09-01 2:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
chenglulu <chenglulu at loongson dot cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #4 from chenglulu <chenglulu at loongson dot cn> ---
resolved
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/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.
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
` (3 preceding siblings ...)
2023-09-01 2:12 ` chenglulu at loongson dot cn
@ 2023-09-01 2:43 ` cvs-commit at gcc dot gnu.org
2023-09-01 3:23 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-01 2:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by LuluCheng
<chenglulu@gcc.gnu.org>:
https://gcc.gnu.org/g:3f23fa7e74fa01828d649e8ee7230701b6fb1e19
commit r13-7773-g3f23fa7e74fa01828d649e8ee7230701b6fb1e19
Author: Lulu Cheng <chenglulu@loongson.cn>
Date: Thu Jun 29 19:30:59 2023 +0800
LoongArch: Fix bug in loongarch_emit_stack_tie [PR110484].
Which may result in implicit references to $fp when frame_pointer_needed is
false,
causing regs_ever_live[$fp] to be true when $fp is not explicitly used,
resulting in $fp being used as the target replacement register in the rnreg
pass.
The bug originates from SPEC2017 541.leela_r(-flto).
gcc/ChangeLog:
PR target/110484
* config/loongarch/loongarch.cc (loongarch_emit_stack_tie): Use the
frame_pointer_needed to determine whether to use the $fp register.
Co-authored-by: Guo Jie <guojie@loongson.cn>
(cherry picked from commit 1967f21d000e09d3d3190317af7923b578ce02b1)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/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.
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
` (4 preceding siblings ...)
2023-09-01 2:43 ` cvs-commit at gcc dot gnu.org
@ 2023-09-01 3:23 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-01 3:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by LuluCheng
<chenglulu@gcc.gnu.org>:
https://gcc.gnu.org/g:d60c00492eb5818493560f299f06d1e3d9efcc69
commit r12-9840-gd60c00492eb5818493560f299f06d1e3d9efcc69
Author: Lulu Cheng <chenglulu@loongson.cn>
Date: Thu Jun 29 19:30:59 2023 +0800
LoongArch: Fix bug in loongarch_emit_stack_tie [PR110484].
Which may result in implicit references to $fp when frame_pointer_needed is
false,
causing regs_ever_live[$fp] to be true when $fp is not explicitly used,
resulting in $fp being used as the target replacement register in the rnreg
pass.
The bug originates from SPEC2017 541.leela_r(-flto).
gcc/ChangeLog:
PR target/110484
* config/loongarch/loongarch.cc (loongarch_emit_stack_tie): Use the
frame_pointer_needed to determine whether to use the $fp register.
Co-authored-by: Guo Jie <guojie@loongson.cn>
(cherry picked from commit 1967f21d000e09d3d3190317af7923b578ce02b1)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-01 3:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 11:25 [Bug c++/110484] New: 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 chenglulu at loongson dot cn
2023-06-29 12:07 ` [Bug c++/110484] " chenglulu at loongson dot cn
2023-06-29 15:33 ` xry111 at gcc dot gnu.org
2023-09-01 2:04 ` [Bug target/110484] " cvs-commit at gcc dot gnu.org
2023-09-01 2:12 ` chenglulu at loongson dot cn
2023-09-01 2:43 ` cvs-commit at gcc dot gnu.org
2023-09-01 3:23 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).