[Bug rtl-optimization/87720] [9 Regression] [MIPS] ICE: gcc.c-torture/execute/builtins/lib/chk.c:33:1: in int_mode_for_mode, at stor-layout.c:403 after r265398

2018-10-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87720

Segher Boessenkool  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Segher Boessenkool  ---
Fixed.

[Bug rtl-optimization/87720] [9 Regression] [MIPS] ICE: gcc.c-torture/execute/builtins/lib/chk.c:33:1: in int_mode_for_mode, at stor-layout.c:403 after r265398

2018-10-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87720

--- Comment #5 from Segher Boessenkool  ---
Author: segher
Date: Wed Oct 24 22:34:40 2018
New Revision: 265474

URL: https://gcc.gnu.org/viewcvs?rev=265474=gcc=rev
Log:
combine: Don't do make_more_copies for dest PC (PR87720)

Jumps are written in RTL as moves to PC.  But the latter has no mode,
so we shouldn't try to use it.  Since the optimization this routine
does does not really help for jumps at all, let's just skip it.


PR rtl-optimization/87720
* combine.c (make_more_copies): Skip if the dest is pc_rtx.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c

[Bug rtl-optimization/87720] [9 Regression] [MIPS] ICE: gcc.c-torture/execute/builtins/lib/chk.c:33:1: in int_mode_for_mode, at stor-layout.c:403 after r265398

2018-10-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87720

Segher Boessenkool  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-10-24
   Assignee|unassigned at gcc dot gnu.org  |segher at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Segher Boessenkool  ---
Okay I managed to build a cross-compiler.  Confirmed; needs -O1 but nothing
more.

(set (pc) (reg:SI 25))

Huh, why did this not happen on any of my builds.  I have a patch.

[Bug rtl-optimization/87720] [9 Regression] [MIPS] ICE: gcc.c-torture/execute/builtins/lib/chk.c:33:1: in int_mode_for_mode, at stor-layout.c:403 after r265398

2018-10-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87720

--- Comment #3 from Segher Boessenkool  ---
Hi Paul,

How can the mode of dest be different from that of the source?  How does PC
get into this?  Could you show an example of bad / good RTL?

[Bug rtl-optimization/87720] [9 Regression] [MIPS] ICE: gcc.c-torture/execute/builtins/lib/chk.c:33:1: in int_mode_for_mode, at stor-layout.c:403 after r265398

2018-10-24 Thread paul.hua.gm at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87720

--- Comment #2 from Paul Hua  ---
untested patch:

Index: gcc/combine.c
===
--- gcc/combine.c   (revision 265456)
+++ gcc/combine.c   (working copy)
@@ -14965,7 +14965,11 @@
  if (TEST_HARD_REG_BIT (fixed_reg_set, REGNO (src)))
continue;

- rtx new_reg = gen_reg_rtx (GET_MODE (dest));
+ rtx new_reg;
+ if (GET_CODE(dest) == PC)
+   new_reg = gen_reg_rtx (GET_MODE (src));
+ else
+   new_reg = gen_reg_rtx (GET_MODE (dest));
  rtx_insn *insn1 = gen_move_insn (new_reg, src);
  rtx_insn *insn2 = gen_move_insn (dest, new_reg);
  emit_insn_after (insn1, insn);
Index: gcc/expr.c
===
--- gcc/expr.c  (revision 265456)
+++ gcc/expr.c  (working copy)
@@ -3684,7 +3684,12 @@
 rtx_insn *
 emit_move_insn_1 (rtx x, rtx y)
 {
-  machine_mode mode = GET_MODE (x);
+  machine_mode mode;
+  if (GET_CODE (x) == PC)
+mode = GET_MODE (y);
+  else /* Include  (GET_CODE (y) = PC) */
+mode = GET_MODE (x);
+
   enum insn_code code;

   gcc_assert ((unsigned int) mode < (unsigned int) MAX_MACHINE_MODE);

[Bug rtl-optimization/87720] [9 Regression] [MIPS] ICE: gcc.c-torture/execute/builtins/lib/chk.c:33:1: in int_mode_for_mode, at stor-layout.c:403 after r265398

2018-10-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87720

Richard Biener  changed:

   What|Removed |Added

 CC||segher at gcc dot gnu.org
  Component|regression  |rtl-optimization
Version|unknown |9.0
   Target Milestone|--- |9.0
Summary|[MIPS] ICE: |[9 Regression] [MIPS] ICE:
   |gcc.c-torture/execute/built |gcc.c-torture/execute/built
   |ins/lib/chk.c:33:1: in  |ins/lib/chk.c:33:1: in
   |int_mode_for_mode, at   |int_mode_for_mode, at
   |stor-layout.c:403 after |stor-layout.c:403 after
   |r265398 |r265398