FDO usability trivial patch to fix div by zero error with insane profile

2011-04-15 Thread Xinliang David Li
This is a trivial patch to deal with bad profile data (from
multi-threaded programs) that leads to divide by zero error.

Ok for trunk?

Thanks,

David



2011-04-15  Xinliang David Li  davi...@google.com

* ipa-inline.c (cgraph_decide_recursive_inlining): Fix
div by zero error with insane profile.
Index: ipa-inline.c
===
--- ipa-inline.c	(revision 172510)
+++ ipa-inline.c	(working copy)
@@ -779,7 +779,7 @@ cgraph_decide_recursive_inlining (struct
 		fprintf (dump_file,Not inlining cold call\n);
 	  continue;
 	}
-  if (curr-count * 100 / node-count  probability)
+  if (node-count == 0 || curr-count * 100 / node-count  probability)
 	{
 	  if (dump_file)
 		fprintf (dump_file,


Re: FDO usability trivial patch to fix div by zero error with insane profile

2011-04-15 Thread Diego Novillo
On Fri, Apr 15, 2011 at 15:20, Xinliang David Li davi...@google.com wrote:
 This is a trivial patch to deal with bad profile data (from
 multi-threaded programs) that leads to divide by zero error.

 Ok for trunk?

 Thanks,

 David



 2011-04-15  Xinliang David Li  davi...@google.com

        * ipa-inline.c (cgraph_decide_recursive_inlining): Fix
        div by zero error with insane profile.

Looks fine to me, but you really want Honza to review this.  Any
chance we can get a test case for this?


Diego.


Re: FDO usability trivial patch to fix div by zero error with insane profile

2011-04-15 Thread Xinliang David Li
There is no way to get a test case that can produce the problem in a
deterministic way.  There is really not much for Honza to review
though :)

David

On Fri, Apr 15, 2011 at 12:52 PM, Diego Novillo dnovi...@google.com wrote:
 On Fri, Apr 15, 2011 at 15:20, Xinliang David Li davi...@google.com wrote:
 This is a trivial patch to deal with bad profile data (from
 multi-threaded programs) that leads to divide by zero error.

 Ok for trunk?

 Thanks,

 David



 2011-04-15  Xinliang David Li  davi...@google.com

        * ipa-inline.c (cgraph_decide_recursive_inlining): Fix
        div by zero error with insane profile.

 Looks fine to me, but you really want Honza to review this.  Any
 chance we can get a test case for this?


 Diego.



Re: FDO usability trivial patch to fix div by zero error with insane profile

2011-04-15 Thread Diego Novillo
On Fri, Apr 15, 2011 at 16:21, Xinliang David Li davi...@google.com wrote:
 There is no way to get a test case that can produce the problem in a
 deterministic way.  There is really not much for Honza to review
 though :)

The check may be needed somewhere else, you may be papering over the
real issue.  I don't think you are but I don't know the code well
enough to say for sure.


Diego.