* [Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
@ 2021-12-15 1:08 ` pinskia at gcc dot gnu.org
2021-12-15 20:43 ` vmakarov at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 1:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
2021-12-15 1:08 ` [Bug target/103722] " pinskia at gcc dot gnu.org
@ 2021-12-15 20:43 ` vmakarov at gcc dot gnu.org
2022-01-04 11:17 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2021-12-15 20:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
--- Comment #1 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Joseph S. Myers from comment #0)
> Created attachment 52003 [details]
> preprocessed source
>
> Build the attached code (from glibc) with -O2 for sh4-linux-gnu. This
> produces an ICE:
>
> malloc-debug.c: In function '__debug_realloc':
> malloc-debug.c:267:1: error: insn does not satisfy its constraints:
> (insn 955 1863 2 2 (set (reg:SI 76 fr12 [314])
> (reg:SI 146 pr)) 189 {movsi_ie}
> (nil))
> during RTL pass: postreload
> malloc-debug.c:267:1: internal compiler error: in extract_constrain_insn, at
> recog.c:2670
> 0x5eec04 _fatal_insn(char const*, rtx_def const*, char const*, int, char
> const*)
> /scratch/jmyers/glibc/many12/src/gcc/gcc/rtl-error.c:108
> 0x5eec2a _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
> /scratch/jmyers/glibc/many12/src/gcc/gcc/rtl-error.c:119
> 0xcab367 extract_constrain_insn(rtx_insn*)
> /scratch/jmyers/glibc/many12/src/gcc/gcc/recog.c:2670
> 0xc71acd reload_cse_simplify_operands
> /scratch/jmyers/glibc/many12/src/gcc/gcc/postreload.c:407
> 0xc732bc reload_cse_simplify
> /scratch/jmyers/glibc/many12/src/gcc/gcc/postreload.c:190
> 0xc732bc reload_cse_regs_1
> /scratch/jmyers/glibc/many12/src/gcc/gcc/postreload.c:238
> 0xc7584b reload_cse_regs
> /scratch/jmyers/glibc/many12/src/gcc/gcc/postreload.c:66
> 0xc7584b execute
> /scratch/jmyers/glibc/many12/src/gcc/gcc/postreload.c:2355
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.
>
> This was introduced (exposed?) by:
>
> commit a7acb6dca941db2b1c135107dac3a34a20650d5c
> Author: Vladimir N. Makarov <vmakarov@redhat.com>
> Date: Mon Dec 13 13:48:12 2021 -0500
>
> [PR99531] Modify pseudo class cost calculation when processing move
> involving the pseudo and a hard register
I am conforming that it was triggered by my patch.
But it is not an IRA bug. The old pass reload (used by SH port) fails to
change insn although insn constraints are not satisfied. The insn in question
is move
fpreg = poreg
The old reload is mistaken by cost of moving prreg to fpreg. SH machine code
provides cost 2 for this. In this case the old reload pass skips checking
constraints of the move.
The following patch solves the problem:
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 0628f059ca2..e7c8e5f84b7 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -10762,6 +10762,12 @@ sh_register_move_cost (machine_mode mode,
&& ! REGCLASS_HAS_GENERAL_REG (dstclass))
return 2 * ((GET_MODE_SIZE (mode) + 7) / 8U);
+ if (((dstclass == FP_REGS || dstclass == DF_REGS)
+ && (srcclass == PR_REGS))
+ || ((srcclass == FP_REGS || srcclass == DF_REGS)
+ && (dstclass == PR_REGS)))
+ return 7;
+
return 2 * ((GET_MODE_SIZE (mode) + 3) / 4U);
}
The patch also makes IRA to allocate a general reg instead of fpreg which is
more costly after applying the patch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
2021-12-15 1:08 ` [Bug target/103722] " pinskia at gcc dot gnu.org
2021-12-15 20:43 ` vmakarov at gcc dot gnu.org
@ 2022-01-04 11:17 ` rguenth at gcc dot gnu.org
2022-01-05 20:54 ` law at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-04 11:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (2 preceding siblings ...)
2022-01-04 11:17 ` rguenth at gcc dot gnu.org
@ 2022-01-05 20:54 ` law at gcc dot gnu.org
2022-05-06 8:32 ` [Bug target/103722] [12/13 " jakub at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: law at gcc dot gnu.org @ 2022-01-05 20:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-01-05
CC| |law at gcc dot gnu.org
--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
I'll confirm. My tester is seeing the same failure building the linux kernel
on sh4/sh4eb and was bisected to the same commit.
Isn't a move cost 2 special to the old reload pass, causing it to avoid various
checks on simple move insns? If so, wouldn't returning any other value be
helpful, and something closer to 2 than 7 would perturb the generated code
less?
Regardless, I'd approve the patch as-is if you submit it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12/13 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (3 preceding siblings ...)
2022-01-05 20:54 ` law at gcc dot gnu.org
@ 2022-05-06 8:32 ` jakub at gcc dot gnu.org
2022-05-08 9:05 ` mikpelinux at gmail dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06 8:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |12.2
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12/13 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (4 preceding siblings ...)
2022-05-06 8:32 ` [Bug target/103722] [12/13 " jakub at gcc dot gnu.org
@ 2022-05-08 9:05 ` mikpelinux at gmail dot com
2022-05-28 18:14 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mikpelinux at gmail dot com @ 2022-05-08 9:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
Mikael Pettersson <mikpelinux at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpelinux at gmail dot com
--- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> ---
This is still happening, and prevents using gcc-12.1.0 to build glibc-2.35.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12/13 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (5 preceding siblings ...)
2022-05-08 9:05 ` mikpelinux at gmail dot com
@ 2022-05-28 18:14 ` cvs-commit at gcc dot gnu.org
2022-05-28 18:16 ` law at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-28 18:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:
https://gcc.gnu.org/g:ce1580252ea57de23a595e9804ea87ed4353aa6a
commit r13-813-gce1580252ea57de23a595e9804ea87ed4353aa6a
Author: Vladimir Makarov <vmakarov@gcc.gnu.org>
Date: Sat May 28 12:08:38 2022 -0600
Fix ICE on sh
gcc/
PR target/103722
* config/sh/sh.cc (sh_register_move_cost): Avoid cost "2" (which
is special) for various scenarios.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12/13 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (6 preceding siblings ...)
2022-05-28 18:14 ` cvs-commit at gcc dot gnu.org
@ 2022-05-28 18:16 ` law at gcc dot gnu.org
2022-07-01 15:27 ` [Bug target/103722] [12 " cvs-commit at gcc dot gnu.org
2022-07-01 15:28 ` jsm28 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: law at gcc dot gnu.org @ 2022-05-28 18:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
--- Comment #6 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Fixed on the trunk. Backporting to the gcc-12 release branch should be safe if
someone wanted to do that.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (7 preceding siblings ...)
2022-05-28 18:16 ` law at gcc dot gnu.org
@ 2022-07-01 15:27 ` cvs-commit at gcc dot gnu.org
2022-07-01 15:28 ` jsm28 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-01 15:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Joseph Myers
<jsm28@gcc.gnu.org>:
https://gcc.gnu.org/g:962e7f0803f163f9cf44d64a2e199935d3f361fe
commit r12-8536-g962e7f0803f163f9cf44d64a2e199935d3f361fe
Author: Vladimir Makarov <vmakarov@gcc.gnu.org>
Date: Sat May 28 12:08:38 2022 -0600
Fix ICE on sh
gcc/
PR target/103722
* config/sh/sh.cc (sh_register_move_cost): Avoid cost "2" (which
is special) for various scenarios.
(cherry picked from commit ce1580252ea57de23a595e9804ea87ed4353aa6a)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4
2021-12-15 1:03 [Bug target/103722] New: [12 Regression] ICE in extract_constrain_insn building glibc for SH4 jsm28 at gcc dot gnu.org
` (8 preceding siblings ...)
2022-07-01 15:27 ` [Bug target/103722] [12 " cvs-commit at gcc dot gnu.org
@ 2022-07-01 15:28 ` jsm28 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2022-07-01 15:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722
Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Now also applied to GCC 12 branch, so fixed for GCC 12.2.
^ permalink raw reply [flat|nested] 11+ messages in thread