public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* FDO usability trivial patch to fix div by zero error with insane profile
@ 2011-04-15 20:21 Xinliang David Li
  2011-04-15 20:21 ` Diego Novillo
  0 siblings, 1 reply; 5+ messages in thread
From: Xinliang David Li @ 2011-04-15 20:21 UTC (permalink / raw)
  To: GCC Patches; +Cc: Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

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  <davidxl@google.com>

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

[-- Attachment #2: div0.p --]
[-- Type: text/x-pascal, Size: 495 bytes --]

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,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FDO usability trivial patch to fix div by zero error with insane profile
  2011-04-15 20:21 FDO usability trivial patch to fix div by zero error with insane profile Xinliang David Li
@ 2011-04-15 20:21 ` Diego Novillo
  2011-04-15 20:33   ` Xinliang David Li
  2011-04-17 16:35   ` Jan Hubicka
  0 siblings, 2 replies; 5+ messages in thread
From: Diego Novillo @ 2011-04-15 20:21 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: GCC Patches, Jan Hubicka

On Fri, Apr 15, 2011 at 15:20, Xinliang David Li <davidxl@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  <davidxl@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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FDO usability trivial patch to fix div by zero error with insane profile
  2011-04-15 20:21 ` Diego Novillo
@ 2011-04-15 20:33   ` Xinliang David Li
  2011-04-15 21:20     ` Diego Novillo
  2011-04-17 16:35   ` Jan Hubicka
  1 sibling, 1 reply; 5+ messages in thread
From: Xinliang David Li @ 2011-04-15 20:33 UTC (permalink / raw)
  To: Diego Novillo; +Cc: GCC Patches, Jan Hubicka

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 <dnovillo@google.com> wrote:
> On Fri, Apr 15, 2011 at 15:20, Xinliang David Li <davidxl@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  <davidxl@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.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FDO usability trivial patch to fix div by zero error with insane profile
  2011-04-15 20:33   ` Xinliang David Li
@ 2011-04-15 21:20     ` Diego Novillo
  0 siblings, 0 replies; 5+ messages in thread
From: Diego Novillo @ 2011-04-15 21:20 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: GCC Patches, Jan Hubicka

On Fri, Apr 15, 2011 at 16:21, Xinliang David Li <davidxl@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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FDO usability trivial patch to fix div by zero error with insane profile
  2011-04-15 20:21 ` Diego Novillo
  2011-04-15 20:33   ` Xinliang David Li
@ 2011-04-17 16:35   ` Jan Hubicka
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Hubicka @ 2011-04-17 16:35 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Xinliang David Li, GCC Patches, Jan Hubicka

> On Fri, Apr 15, 2011 at 15:20, Xinliang David Li <davidxl@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  <davidxl@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?

Yes, this is OK for release branches.
On mainline I already fixed it with the current inliner reorg.  The weird think
is that the problem reproduce with sqlite build when profile is not present and
thus all counters should be zero.  Since the division is already guarded by
max_count being 0, someone must set non-zero count of some cgrpah edge that is
wrong.  I will need to investigate this...

Thanks,
Honza
> 
> 
> Diego.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-17 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15 20:21 FDO usability trivial patch to fix div by zero error with insane profile Xinliang David Li
2011-04-15 20:21 ` Diego Novillo
2011-04-15 20:33   ` Xinliang David Li
2011-04-15 21:20     ` Diego Novillo
2011-04-17 16:35   ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).