ipa-inline-analysis.c (estimate_node_size_and_time): Allow roundoff errors when compa...
authorJan Hubicka <hubicka@ucw.cz>
Tue, 2 May 2017 22:35:24 +0000 (00:35 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 2 May 2017 22:35:24 +0000 (22:35 +0000)
* ipa-inline-analysis.c (estimate_node_size_and_time): Allow roundoff
errors when comparing specialized and unspecialized times.

From-SVN: r247528

gcc/ChangeLog
gcc/ipa-inline-analysis.c

index 2b6dfb3a45c2ff19946c9da24bfea0d7e3731324..61a33210c0b49f8b160b47dac1edc0166cf8140c 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-02  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-inline-analysis.c (estimate_node_size_and_time): Allow roundoff
+       errors when comparing specialized and unspecialized times.
+
 2017-05-02  David Malcolm  <dmalcolm@redhat.com>
 
        * diagnostic-show-locus.c
        if the only reason why modified_in_p returned true is that
        addr is SP based and set_insn is a push or pop.
 
+2017-04-29  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-inline.c (compute_inlined_call_time): Remove now unnecesary
+       overflow check.
+
 2017-04-29  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/79224
index 81183cffdfa6f5e1fa0d030ad4caddf949df161b..929de8e9791a9b91d54096e134116e0be4f15d82 100644 (file)
@@ -3422,7 +3422,15 @@ estimate_node_size_and_time (struct cgraph_node *node,
   min_size = (*info->entry)[0].size;
   gcc_checking_assert (size >= 0);
   gcc_checking_assert (time >= 0);
-  gcc_checking_assert (nonspecialized_time >= time);
+  /* nonspecialized_time should be always bigger than specialized time.
+     Roundoff issues however may get into the way.  */
+  gcc_checking_assert ((nonspecialized_time - time) >= -1);
+
+  /* Roundoff issues may make specialized time bigger than nonspecialized
+     time.  We do not really want that to happen because some heurstics
+     may get confused by seeing negative speedups.  */
+  if (time > nonspecialized_time)
+    time = nonspecialized_time;
 
   if (info->loop_iterations
       && !evaluate_predicate (info->loop_iterations, possible_truths))