[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-11-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||jakub at gcc dot gnu.org
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |vmakarov at gcc dot 
gnu.org

--- Comment #9 from Jakub Jelinek  ---
Let's assume it is.  If not, please reopen.

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-08-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

--- Comment #8 from Martin Liška  ---
@Vladimir: Can the bug be marked as resolved?

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-25 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

--- Comment #7 from Vladimir Makarov  ---
Author: vmakarov
Date: Thu Jul 25 18:36:52 2019
New Revision: 273810

URL: https://gcc.gnu.org/viewcvs?rev=273810&root=gcc&view=rev
Log:
2019-07-25  Vladimir Makarov  

PR rtl-optimization/91223
* lra-constraints.c (process_alt_operands): Fail for unsuccessful
matching with INOUT operand.

2019-07-25  Vladimir Makarov  

PR rtl-optimization/91223
* gcc.target/i386/pr91223.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr91223.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-constraints.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-24 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

Vladimir Makarov  changed:

   What|Removed |Added

 CC||vmakarov at gcc dot gnu.org

--- Comment #6 from Vladimir Makarov  ---
  Thank you for reporting this.  I've started to work on the PR.  I think the
fix will be ready this week.

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-24 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

--- Comment #5 from Martin Liška  ---
I have one another smaller test-case:

$ cat ice.i
int a;
void fn2(short, short);

void fn1(void) {
  short b[8];
  b[0] |= a & 3;
  b[1] = a;
  fn2(b[0], b[1]);
}

$ gcc ice.i -c -Og -fno-tree-fre
during RTL pass: reload
ice.i: In function ‘fn1’:
ice.i:9:1: internal compiler error: in curr_insn_transform, at
lra-constraints.c:4459
9 | }
  | ^
0x6819a5 curr_insn_transform
/home/marxin/Programming/gcc/gcc/lra-constraints.c:4459
0xc262a4 lra_constraints(bool)
/home/marxin/Programming/gcc/gcc/lra-constraints.c:4987
0xc137b4 lra(_IO_FILE*)
/home/marxin/Programming/gcc/gcc/lra.c:2468
0xbcb7f1 do_reload
/home/marxin/Programming/gcc/gcc/ira.c:5522
0xbcb7f1 execute
/home/marxin/Programming/gcc/gcc/ira.c:5706
Please submit a full bug report,

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-23 Thread su at cs dot ucdavis.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

Zhendong Su  changed:

   What|Removed |Added

 CC||su at cs dot ucdavis.edu

--- Comment #4 from Zhendong Su  ---
Another and somewhat smaller test that triggers the same ICE: 

[513] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/suz/software/gcctk/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --disable-multilib
--enable-languages=c,c++,lto --prefix=/home/suz/software/gcctk/gcc-trunk
--disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.0 20190722 (experimental) [trunk revision 273699] (GCC) 
[514] % 
[514] % gcctk -O1 small.c
during RTL pass: reload
small.c: In function ‘main’:
small.c:45:1: internal compiler error: in curr_insn_transform, at
lra-constraints.c:4459
   45 | }
  | ^
0xad2168 curr_insn_transform
../../gcc-source-trunk/gcc/lra-constraints.c:4459
0xad4086 lra_constraints(bool)
../../gcc-source-trunk/gcc/lra-constraints.c:4987
0xabbc14 lra(_IO_FILE*)
../../gcc-source-trunk/gcc/lra.c:2468
0xa6deb9 do_reload
../../gcc-source-trunk/gcc/ira.c:5522
0xa6deb9 execute
../../gcc-source-trunk/gcc/ira.c:5706
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[515] % 
[515] % cat small.c
int printf (const char *, ...);

struct S
{
  int f1;
  int f2; 
  int f3;
  char f4;
  int f5; 
} a, b, c;

int d, e, f, j, k, l;

int main ()
{
  short g[2];
  int i = 0;
  for (; i < 2; i++)
g[i] = 1;
  while (f)
{
  if (l)
g[0] ^= c.f4;
  while (1)
{
  if (j)
break;
  int n = e, o;
  while (a.f2)
{
  struct S p;
  if (o)
{
  int q = k && q; 
  printf ("%d", c.f1);
  if (b.f5)
o = p.f3;
  d = n;
}
}
  f = g[0];
}
}
  return 0;
}

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-22 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

Uroš Bizjak  changed:

   What|Removed |Added

 CC||jakub at redhat dot com,
   ||law at redhat dot com,
   ||vmakarov at redhat dot com

--- Comment #3 from Uroš Bizjak  ---
(In reply to Martin Liška from comment #2)
> Confirmed, started with r273578.

Some analysis:

The reload failure happens with:

(insn 76 75 77 4 (parallel [
(set (strict_low_part (subreg:QI (reg:DI 202 [ c+8 ]) 0))
(xor:QI (reg:QI 198)
(subreg:QI (reg:DI 202 [ c+8 ]) 0)))
(clobber (reg:CC 17 flags))
]) "pr91223.c":27:12 429 {*xorqi_1_slp}
 (expr_list:REG_DEAD (reg:QI 198)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil

Previously, the pattern was defined as:

(define_insn "*qi_1_slp"
  [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m"))
(any_or:QI (match_dup 0)
   (match_operand:QI 1 "general_operand" "qmn,qn")))
   (clobber (reg:CC FLAGS_REG))]
  "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
   && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
  "{b}\t{%1, %0|%0, %1}"
  [(set_attr "type" "alu1")
   (set_attr "mode" "QI")])

and later, it was corrected/improved to:

(define_insn "*_1_slp"
  [(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+"))
(any_or:SWI12 (match_operand:SWI12 1 "nonimmediate_operand" "%0")
  (match_operand:SWI12 2 "general_operand" "mn")))
   (clobber (reg:CC FLAGS_REG))]
  "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
   /* FIXME: without this LRA can't reload this pattern, see PR82524.  */
   && (rtx_equal_p (operands[0], operands[1])
   || rtx_equal_p (operands[0], operands[2]))"
  "{}\t{%2, %0|%0, %2}"
  [(set_attr "type" "alu")
   (set_attr "mode" "")])

Please note that the output can match either input, taking "%" into
consideration. This is the reason for rtx_equal_p condition, effectively a
(match dup X) in the original pattern.

I suspect that this part of LRA doesn't consider "%" modifier, since insn
constraint should (according to PR82524) help LRA to resolve the reloading.

I don't see anything wrong with the pattern. Let's ask experts if it triggers
some (un)known limitation in LRA.

[Bug rtl-optimization/91223] [10 Regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to work||9.1.0
   Keywords||ice-on-valid-code
   Last reconfirmed||2019-07-22
 CC||marxin at gcc dot gnu.org,
   ||uros at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|[10 regression] ICE: in |[10 Regression] ICE: in
   |curr_insn_transform, at |curr_insn_transform, at
   |lra-constraints.c:4459  |lra-constraints.c:4459
   Target Milestone|--- |10.0
  Known to fail||10.0

--- Comment #2 from Martin Liška  ---
Confirmed, started with r273578.

[Bug rtl-optimization/91223] [10 regression] ICE: in curr_insn_transform, at lra-constraints.c:4459

2019-07-22 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91223

--- Comment #1 from Dmitry G. Dyachenko  ---
slightly reduced

$ cat y.i
int a, g;
int *b, *f, *h;
void *memcpy(void *, const void *, unsigned long);
typedef struct {
  int b;
} * c;
int d(void);
c e;
int d() {
  char c[16];
bd:
  for (a = 0; a <= 1; a++) {
*c = *f;
*(c + 8 + 5) = *(c + 8 + 6) = g + 1;
unsigned long d[2];
*d = c[0] + c[1];
*(d + 1) = *(b + c[0]) * *b;
*d = *d ^ c[1];
*(d + 1) =
*(d + 1) ^ (long)b ^ c[5] << 1 ^ *(unsigned long *)b ^ *c ^ *(b +
c[1]);
*d = *d ^ *(b + c[13]);
*(d + 1) = *(d + 1) ^ *(b + c[13] + 1);
*d = *d ^ *(b + 1) ^ c[14] * c[15];
*(d + 1) = *(d + 1) ^ *b;
memcpy(c, d, 16);
  }
  *(c + 8) = *(c + 8) ^ *f ^ e->b;
  memcpy(h, c, 16);
  if (0)
goto bd;
  return 0;
}