diff mbox

Fix bootstrap on i686 (PR middle-end/69542)

Message ID 20160128201751.GH3017@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 28, 2016, 8:17 p.m. UTC
Hi!

The recent lra-remat.c change broke bootstrap for me on i686,
with comparison failure on simplify-rtx.o.
Below is a reduced testcase.  debug insns really should not affect
remat decisions, before the recent changes set_bb_regs should be always a
nop on debug insns (they don't change any registers, and don't have REG_DEAD
notes).  But they could have subregs of multiword regs.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-01-28  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/69542
	* lra-remat.c (calculate_local_reg_remat_bb_data): Only consider
	non-debug insns.

	* gcc.dg/torture/pr69542.c: New test.



	Jakub

Comments

Richard Henderson Jan. 28, 2016, 8:58 p.m. UTC | #1
On 01/28/2016 12:17 PM, Jakub Jelinek wrote:
> The recent lra-remat.c change broke bootstrap for me on i686,
> with comparison failure on simplify-rtx.o.
> Below is a reduced testcase.  debug insns really should not affect
> remat decisions, before the recent changes set_bb_regs should be always a
> nop on debug insns (they don't change any registers, and don't have REG_DEAD
> notes).  But they could have subregs of multiword regs.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2016-01-28  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/69542
> 	* lra-remat.c (calculate_local_reg_remat_bb_data): Only consider
> 	non-debug insns.
> 
> 	* gcc.dg/torture/pr69542.c: New test.

Looks good to me.  Thanks.

Can you please apply to gcc-5-branch too, since I've
already applied the 69449 patch there.


r~
diff mbox

Patch

--- gcc/lra-remat.c.jj	2016-01-28 15:07:24.000000000 +0100
+++ gcc/lra-remat.c	2016-01-28 18:24:43.778297120 +0100
@@ -694,7 +694,7 @@  calculate_local_reg_remat_bb_data (void)
 
   FOR_EACH_BB_FN (bb, cfun)
     FOR_BB_INSNS (bb, insn)
-      if (INSN_P (insn))
+      if (NONDEBUG_INSN_P (insn))
 	set_bb_regs (bb, insn);
 }
 
--- gcc/testsuite/gcc.dg/torture/pr69542.c.jj	2016-01-28 18:54:49.477968076 +0100
+++ gcc/testsuite/gcc.dg/torture/pr69542.c	2016-01-28 18:55:16.786599654 +0100
@@ -0,0 +1,37 @@ 
+/* PR middle-end/69542 */
+/* { dg-do compile } */
+/* { dg-additional-options "-fcompare-debug" } */
+
+typedef struct A *B;
+extern int *a[];
+struct C { B b; struct D *d; };
+struct A { struct { struct C e[1]; long long f[1]; } u; };
+struct D { int g; B h[100]; };
+int b, c, e, g;
+B d, f;
+void foo (void) __attribute__ ((__noreturn__));
+int bar (void)
+{
+  int i = 0;
+  do
+    {
+      if ('E' && a[e][0] != 'V')
+        foo ();
+      struct D *k = d->u.e[0].d;
+      B x = k->h[i], o = f->u.e[0].b;
+      if (b)
+        return 0;
+      if (a[g][0] != 'E' && a[g][0] != 'V')
+        foo ();
+      struct D *n = o->u.e[0].d;
+      int r = x->u.f[0];
+      (void) r;
+      if (c)
+        foo ();
+      B y = n->h[x->u.f[0]];
+      if (i != y->u.f[0])
+        return 0;
+      i++;
+    }
+  while (1);
+}