public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Jan Hubicka <hubicka@ucw.cz>,
	gcc-patches@gcc.gnu.org,	rguenther@suse.de, mjambor@suse.cz
Subject: Re: [RFC] Context sensitive inline analysis
Date: Tue, 27 Sep 2011 16:20:00 -0000	[thread overview]
Message-ID: <20110927144617.GF21364@kam.mff.cuni.cz> (raw)
In-Reply-To: <BANLkTimL2ypnbpmyNYJGJjSq33Zv7zgUGQ@mail.gmail.com>

> > This caused:
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49179
> >
> >
> 
> This also caused:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49091
> 

Hi,
the problem is sign overflow in time computation. Time should be capped by MAX_TIME
and we compute MAX_TIME * INLINE_SIZE_SCALE * 2. This happens to be >2^31 & <2^32
so we overflow here because of use of signed arithmetics.

Hopefully the following is enough.  The floating point arithmetics would make things easier
since loop structure can scale times up a lot and their relative comparsions matters for
benefit computation.  Not sure if switching it to our software floats is the coolest
idea however.

Will commit it after testing on x86_64-linux

Index: ipa-inline-analysis.c
===================================================================
--- ipa-inline-analysis.c	(revision 179266)
+++ ipa-inline-analysis.c	(working copy)
@@ -92,7 +92,7 @@ along with GCC; see the file COPYING3.
 /* Estimate runtime of function can easilly run into huge numbers with many
    nested loops.  Be sure we can compute time * INLINE_SIZE_SCALE in integer.
    For anything larger we use gcov_type.  */
-#define MAX_TIME 1000000
+#define MAX_TIME 500000
 
 /* Number of bits in integer, but we really want to be stable across different
    hosts.  */

  reply	other threads:[~2011-09-27 14:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 14:17 Jan Hubicka
2011-04-22 21:02 ` Jan Hubicka
2011-04-23  0:14   ` Jan Hubicka
2011-04-23 10:47     ` Richard Guenther
2011-04-23 17:00       ` Jan Hubicka
2011-05-27  8:31 ` H.J. Lu
2011-05-27  8:52   ` H.J. Lu
2011-09-27 16:20     ` Jan Hubicka [this message]
2011-09-28 11:56       ` Richard Sandiford
2011-10-03  8:12         ` Richard Sandiford
2011-04-25 15:35 David Edelsohn
2011-04-26 13:02 ` Jan Hubicka
2011-04-27 13:18 ` Jan Hubicka
2011-04-27 14:38   ` H.J. Lu
2011-04-27 15:46     ` Jan Hubicka
2011-04-28 13:27       ` David Edelsohn
2011-04-28 13:43         ` Jan Hubicka
     [not found]           ` <BANLkTikScRy+QwZiPyGhHhmuu+ACF65HJA@mail.gmail.com>
2011-04-30 13:38             ` Jan Hubicka
2011-04-30 16:38               ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110927144617.GF21364@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=mjambor@suse.cz \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).