]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/60013 (Build of 176.gcc from CPU2000 loops in cc1 starting with...
authorJan Hubicka <hubicka@ucw.cz>
Thu, 6 Feb 2014 07:39:24 +0000 (08:39 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 6 Feb 2014 07:39:24 +0000 (07:39 +0000)
PR middle-end/60013
* ipa-inline-analysis.c (compute_bb_predicates): Ensure monotonicity
of the dataflow.
* gcc.dg/pr60013.c: New testcase.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r207529

gcc/ChangeLog
gcc/ipa-inline-analysis.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr60013.c [new file with mode: 0644]

index 2dbab7292adce42382371c293e08fa301c596f76..83d021a4748374bfb1047b9a3c4698c573bea5f1 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-05  Jan Hubicka  <hubicka@ucw.cz>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/60013
+       * ipa-inline-analysis.c (compute_bb_predicates): Ensure monotonicity
+       of the dataflow.
+
 2014-02-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Change
index ffb8264a459e48caac74d1cef9dc7e2f8a0d552d..6cd5dc1c2e57be49e8670b908b8af213c5f7e0c8 100644 (file)
@@ -310,7 +310,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
   if (false_predicate_p (p))
     return;
 
-  /* No one should be sily enough to add false into nontrivial clauses.  */
+  /* No one should be silly enough to add false into nontrivial clauses.  */
   gcc_checking_assert (!(clause & (1 << predicate_false_condition)));
 
   /* Look where to insert the clause.  At the same time prune out
@@ -1035,7 +1035,7 @@ inline_node_removal_hook (struct cgraph_node *node,
   memset (info, 0, sizeof (inline_summary_t));
 }
 
-/* Remap predicate P of former function to be predicate of duplicated functoin.
+/* Remap predicate P of former function to be predicate of duplicated function.
    POSSIBLE_TRUTHS is clause of possible truths in the duplicated node,
    INFO is inline summary of the duplicated node.  */
 
@@ -1887,8 +1887,15 @@ compute_bb_predicates (struct cgraph_node *node,
                }
              else if (!predicates_equal_p (&p, (struct predicate *) bb->aux))
                {
-                 done = false;
-                 *((struct predicate *) bb->aux) = p;
+                 /* This OR operation is needed to ensure monotonous data flow
+                    in the case we hit the limit on number of clauses and the
+                    and/or operations above give approximate answers.  */
+                 p = or_predicates (summary->conds, &p, (struct predicate *)bb->aux);
+                 if (!predicates_equal_p (&p, (struct predicate *) bb->aux))
+                   {
+                     done = false;
+                     *((struct predicate *) bb->aux) = p;
+                   }
                }
            }
        }
index c81a00dfbaab3a25a7ad8132465ee2773d4c5064..efa42473a10d464d6025f94075001f44e5e0936e 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-05  Jan Hubicka  <hubicka@ucw.cz>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/60013
+       * gcc.dg/pr60013.c: New testcase.
+
 2014-02-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * gcc.dg/vmx/sum2s.c: New.
diff --git a/gcc/testsuite/gcc.dg/pr60013.c b/gcc/testsuite/gcc.dg/pr60013.c
new file mode 100644 (file)
index 0000000..5c2ec51
--- /dev/null
@@ -0,0 +1,47 @@
+/* PR ipa/60013 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef long int jmp_buf[64];
+extern int _setjmp (jmp_buf) __attribute__ ((__nothrow__));
+struct S { int a, b, c; };
+extern struct S *baz (struct S *);
+static jmp_buf j;
+
+static inline int
+bar (int b, int d)
+{
+  return (b & d) < 0;
+}
+
+struct S *
+foo (int a, struct S *b, struct S *c, struct S *d)
+{
+  if (b->a == 0)
+    {
+      switch (a)
+       {
+       case 8:
+         return baz (b);
+       case 7:
+         bar (b->c, c->b);
+         return 0;
+       case 6:
+       case 5:
+       case 4:
+         return baz (c);
+       case 3:
+       case 2:
+         return baz (d);
+       }
+      return 0;
+    }
+  if (b->a == 1)
+    {
+      if (baz (c))
+       return c;
+      else if (_setjmp (j))
+       baz (b);
+    }
+  return 0;
+}