* [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