re PR ipa/83051 (ICE on valid code at -O3: in edge_badness, at ipa-inline.c:1024)
authorJan Hubicka <hubicka@ucw.cz>
Sun, 14 Jan 2018 11:20:31 +0000 (12:20 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 14 Jan 2018 11:20:31 +0000 (11:20 +0000)
PR ipa/83051
* gcc.c-torture/compile/pr83051.c: New testcase.
* ipa-inline.c (edge_badness): Tolerate roundoff errors.

From-SVN: r256659

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr83051.c [new file with mode: 0644]

index abce2c83d5336f267df4bd42312aac2831480a20..ed1e0ef13249bf0b9178e1278292e79bdd578d3a 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-14  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/83051
+       * ipa-inline.c (edge_badness): Tolerate roundoff errors.
+
 2018-01-14  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * ipa-inline.c (want_inline_small_function_p): Return false if
index c3acfb29b4029b2f097042d0442a717fcfe6e435..145ffbb5ef0d81fa6af08c47df77c87395352179 100644 (file)
@@ -997,7 +997,8 @@ edge_badness (struct cgraph_edge *edge, bool dump)
   /* Check that inlined time is better, but tolerate some roundoff issues.
      FIXME: When callee profile drops to 0 we account calls more.  This
      should be fixed by never doing that.  */
-  gcc_checking_assert ((edge_time - callee_info->time).to_int () <= 0
+  gcc_checking_assert ((edge_time * 100
+                       - callee_info->time * 101).to_int () <= 0
                        || callee->count.ipa ().initialized_p ());
   gcc_checking_assert (growth <= callee_info->size);
 
index d8263d6ab3a52805d28d0c4bb5d3ef6a05328c1b..c07fada1ac872bdae07e903b3a447b24e2441e7c 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-14  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/83051
+       * gcc.c-torture/compile/pr83051.c: New testcase.
+
 2018-01-14  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR tree-optimization/83501
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83051.c b/gcc/testsuite/gcc.c-torture/compile/pr83051.c
new file mode 100644 (file)
index 0000000..133cabc
--- /dev/null
@@ -0,0 +1,31 @@
+
+int a[1], b, c, d, e, f, g, h;
+
+void fn1 (int p)
+{ 
+  b = b >> 8 ^ a[b ^ (c & 5)] >> 8 ^ a[(b ^ c) & 5];
+  b = b >> 8 ^ a[(b ^ c) & 5];
+}
+
+static void fn2 ()
+{ 
+  int k;
+  while (1)
+    while (e)
+      { 
+        while (g)
+          while (h)
+            for (k = 0; k < 6; k++)
+              while (f)
+                fn1 (0);
+        fn1 (0);
+        fn1 (0);
+        fn1 (0);
+      }
+}
+
+int main ()
+{ 
+  fn2 ();
+  return 0;
+}