Patchwork New badness metric for inliner

login
register
mail settings
Submitter Jan Hubicka
Date Nov. 6, 2012, 9:11 p.m.
Message ID <20121106211143.GA22247@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/197544/
State New
Headers show

Comments

Jan Hubicka - Nov. 6, 2012, 9:11 p.m.
> From: Jan Hubicka <hubicka@ucw.cz>
> Date: Tue, 6 Nov 2012 22:01:27 +0100
> 
> > Hmm, this is obvoiusly wrong.  All the caller time computation should be capped
> > to MAX_TIME that should be safe from overflows.
> 
> They are not capped to MAX_TIME.
> 
> They are capped to MAX_TIME * INLINE_TIME_SCALE which is
> 1000000000.

Right and that is why they need to be capped after every addition.
(while writting the code it did not have the INLINE_TIME_SCALE
factor yet and I concluded I do not need to do capping because 
there are at most 32 additions).

I noticed there is one extra place with this problem, so I fixed it, too.

The attached patch fixes the testcase, so I comitted it as obvious.  Hope it
will fix the bootstrap for you. I did not hit this because my bootstrap did not
have graphite enabled due to lack of proper support libraries.

Comitted as obvious.

	* ipa-inline-analysis.c (estimate_function_body_sizes,
	inline_update_overall_summary): Cap time calculations.
David Miller - Nov. 6, 2012, 10:58 p.m.
From: Jan Hubicka <hubicka@ucw.cz>
Date: Tue, 6 Nov 2012 22:11:44 +0100

> The attached patch fixes the testcase, so I comitted it as obvious.  Hope it
> will fix the bootstrap for you. I did not hit this because my bootstrap did not
> have graphite enabled due to lack of proper support libraries.
> 
> Comitted as obvious.
> 
> 	* ipa-inline-analysis.c (estimate_function_body_sizes,
> 	inline_update_overall_summary): Cap time calculations.

Bootstrap is working again for me, thanks Jan!

Patch

Index: ipa-inline-analysis.c
===================================================================
--- ipa-inline-analysis.c	(revision 193246)
+++ ipa-inline-analysis.c	(working copy)
@@ -2442,6 +2442,8 @@  estimate_function_body_sizes (struct cgr
 		{
 		  time += this_time;
 		  size += this_size;
+		  if (time > MAX_TIME * INLINE_TIME_SCALE)
+		    time = MAX_TIME * INLINE_TIME_SCALE;
 		}
 
 	      /* We account everything but the calls.  Calls have their own
@@ -3323,7 +3325,11 @@  inline_update_overall_summary (struct cg
   info->size = 0;
   info->time = 0;
   for (i = 0; VEC_iterate (size_time_entry, info->entry, i, e); i++)
-    info->size += e->size, info->time += e->time;
+    {
+      info->size += e->size, info->time += e->time;
+      if (info->time > MAX_TIME * INLINE_TIME_SCALE)
+        info->time = MAX_TIME * INLINE_TIME_SCALE;
+    }
   estimate_calls_size_and_time (node, &info->size, &info->time, NULL,
 				~(clause_t)(1 << predicate_false_condition),
 				NULL, NULL, NULL);