[Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4

2022-07-01 Thread jsm28 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722

Joseph S. Myers  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Joseph S. Myers  ---
Now also applied to GCC 12 branch, so fixed for GCC 12.2.

[Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4

2022-07-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722

--- Comment #7 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Joseph Myers
:

https://gcc.gnu.org/g:962e7f0803f163f9cf44d64a2e199935d3f361fe

commit r12-8536-g962e7f0803f163f9cf44d64a2e199935d3f361fe
Author: Vladimir Makarov 
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)

[Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4

2022-01-05 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722

Jeffrey A. Law  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  ---
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.

[Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4

2022-01-04 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4

2021-12-15 Thread vmakarov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722

--- Comment #1 from Vladimir Makarov  ---
(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  for instructions.
> 
> This was introduced (exposed?) by:
> 
> commit a7acb6dca941db2b1c135107dac3a34a20650d5c
> Author: Vladimir N. Makarov 
> 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.

[Bug target/103722] [12 Regression] ICE in extract_constrain_insn building glibc for SH4

2021-12-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103722

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0