diff mbox

patch to fix PR80193

Message ID 1cc5bb6d-7032-ae37-6ca9-4d72dd69219d@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov March 28, 2017, 8:57 p.m. UTC
The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80193

The patch was successfully bootstrapped on x86-64.

Committed as rev. 246554.
diff mbox

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 246553)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2017-03-28  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/80193
+	* ira.c (ira): Do not check allocation for LRA.
+
 2017-03-28  Alexander Monakov  <amonakov@ispras.ru>
 
 	* config/nvptx/nvptx-protos.h (nvptx_output_simt_enter): Declare.
Index: ira.c
===================================================================
--- ira.c	(revision 246536)
+++ ira.c	(working copy)
@@ -5334,7 +5334,6 @@ 
                                        reg_alternate_class (old_regno),
                                        reg_allocno_class (old_regno));
                 }
-
 	    }
 	  else
 	    {
@@ -5370,7 +5369,14 @@ 
   calculate_allocation_cost ();
 
 #ifdef ENABLE_IRA_CHECKING
-  if (ira_conflicts_p)
+  if (ira_conflicts_p && ! ira_use_lra_p)
+    /* Opposite to reload pass, LRA does not use any conflict info
+       from IRA.  We don't rebuild conflict info for LRA (through
+       ira_flattening call) and can not use the check here.  We could
+       rebuild this info for LRA in the check mode but there is a risk
+       that code generated with the check and without it will be a bit
+       different.  Calling ira_flattening in any mode would be a
+       wasting CPU time.  So do not check the allocation for LRA.  */
     check_allocation ();
 #endif
 
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 246553)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2017-03-28  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/80193
+	* gcc.target/i386/pr80193.c: New.
+
 2017-03-28  Janus Weil  <janus@gcc.gnu.org>
 
 	PR fortran/78661
Index: testsuite/gcc.target/i386/pr80193.c
===================================================================
--- testsuite/gcc.target/i386/pr80193.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr80193.c	(working copy)
@@ -0,0 +1,196 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int printf (const char *, ...);
+
+char a, e, h, ag, ak, am, ar, ay, az, bc, bd, k, l;
+int f, i, n, o, c, ac, ad, p, ah, s, aj, al, an, b, ao, aq, at, av, be, t, u, g, q, r, ai, **aa, ap;
+
+int d (int v)
+{ 
+  return v + a;
+}
+
+int j (char v, char w)
+{ 
+  return v - w;
+}
+
+void m (int p)
+{
+}
+
+static void bf ()
+{ 
+  int bg[240], bi, bk, bl, bj, bm = -1;
+  const int *bh;
+  if (h)
+    { 
+      int bn, bo;
+      while (1)
+        { 
+          int *bp = &at;
+          const int **bq = &bh, **br = bq;
+          while (av)
+            while (ah)
+              ;
+          int bs = r, bt;
+          if (bt)
+            break;
+        bu:
+          for (; r; r = d (r))
+            { 
+              *bp = j (q && b, 0);
+              if (n)
+                u = b;
+              if (u && ak)
+                p = 0;
+            }
+          if (c)
+            { 
+              while (a)
+                while (r)
+                  { 
+                    int bw = ar, bx = an;
+                  by:
+                    printf ("%d\n", an);
+                    while (ao)
+                      while (bw)
+                        { 
+                          a = !g || f / g;
+                          if (i)
+                            az = i;
+                          l = j (q && bh, 5);
+                          if (n != 0)
+                            t = l / n;
+                          if (t)
+                            while (bo)
+                              ;
+                        }
+                    while (a)
+                      ;
+                    if (s)
+                      while (bx)
+                        while (1)
+                          { 
+                            if (r)
+                              break;
+                            *aa || q;
+                          }
+                    while (at)
+                      ;
+                  }
+              while (av)
+                if (b)
+                  goto by;
+              while (bl)
+                while (1)
+                  { 
+                    if (r)
+                      break;
+                    while (ag)
+                      if (bi)
+                        printf ("%d\n", 0);
+                    if (bk)
+                      { 
+                        bo = bn = bi = printf ("");
+                        goto bz;
+                      }
+                    while (o)
+                      if (a)
+                        { 
+                          while (1)
+                            ;
+                        ca:
+                          ;
+                        }
+                    if (ap)
+                      while (1)
+                        ;
+                    while (a)
+                      { 
+                        if (ai)
+                          {
+                          bz:
+                            while (be)
+                              if (a)
+                                while (bn)
+                                  bl = bg[am];
+                            while (ac)
+                              if (ad)
+                                { 
+                                  bj++;
+                                  while (bj)
+                                    if (c)
+                                      goto bu;
+                                }
+                            if (s)
+                              { 
+                                while (ao)
+                                  while (f)
+                                    while (p)
+                                      if (e)
+                                        while (bj)
+                                          for (; bo;)
+                                            ;
+                                if (aq)
+                                  { 
+                                    while (aj)
+                                      ;
+                                    continue;
+                                  }
+                                while (1)
+                                  ;
+                              }
+                            while (!bj)
+                              { 
+                                al = 0;
+                                for (; al < 6; al++)
+                                  { 
+                                    ai = 0;
+                                    for (; ai < 60; ai = d (ai))
+                                      { 
+                                        k = !g || f / g;
+                                        if (i)
+                                          ay = 0;
+                                        bc = j (q && *bq, ay);
+                                        if (!n)
+                                          ;
+                                        else
+                                          bd = bc / n;
+                                        if (**bq)
+                                          __builtin_abort ();
+                                        *bp = !aa;
+                                      }
+                                    while (av)
+                                      for (; ai; ai++)
+                                        for (; ar; ar++)
+                                          { 
+                                            int cb;
+                                            *aa = &cb;
+                                          }
+                                    m ((long) &br);
+                                    while (an)
+                                      while (1)
+                                        ;
+                                  }
+                              }
+                          }
+                        o = b;
+                      }
+                    while (bs)
+                      bm++;
+                    while (bm)
+                      ;
+                  }
+            }
+        }
+      goto ca;
+    }
+}
+
+int main ()
+{ 
+  bf ();
+  return 0;
+}