public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org,  patches@linaro.org
Subject: Re: [2/2] Reducing the overhead of dwarf2 location tracking
Date: Fri, 04 Mar 2011 14:47:00 -0000	[thread overview]
Message-ID: <g4y64vuemp.fsf@linaro.org> (raw)
In-Reply-To: <AANLkTi=fnEdfJoaMfvQmtmHYeUmecAuck5K=TGE+Xx-T@mail.gmail.com>	(Richard Guenther's message of "Fri, 4 Mar 2011 15:30:34 +0100")

Richard Guenther <richard.guenther@gmail.com> writes:
> On Fri, Mar 4, 2011 at 2:56 PM, Richard Sandiford
> <richard.sandiford@linaro.org> wrote:
>> Suppose we have a function F that is inlined several times.  Suppose too
>> that F has a local variable X, and that no "real" (as opposed to debug)
>> references to X remain after pre-inlining optimisations.  In this case,
>> we will add X to BLOCK_NONLOCALIZED_VARS rather than duplicate it each
>> time F is inlined.  Location notes for each inlining of F will then
>> refer to the same non-localised X decl.  This in turn means that each
>> inlining of F has the same location list for X, with the list specifying
>> the location of X for all inlinings of F.
>>
>> Jakub confirms that this indeed the intended behaviour, and I haven't
>> seen any problem with the output.
>
> Hm, but isn't it incorrect debug info?  I would have expected this
> non-localized var to be the abstract origin of a copy for location
> list purposes.
>
> Well, for
>
> static inline int foo (int p) { int q = p; return q; }
> int bar1 (int i)
> {
>   return foo (i);
> }
> int bar2 (int j)
> {
>   return foo (j);
> }
>
> I don't even see location lists for q, but maybe I'm blind ;)

Yeah, it does seem to be a bit selective.

FWIW, I used the attached while writing the patch.  The count* variables
are affected.  I was using a ulimit of 1GB (IIRC): without the patch,
the OOM_BEFORE definition of A2 caused an OOM, whereas after it,
the longer definition was OK.

Richard


volatile int g;

static inline __attribute__((always_inline)) int
f (int x)
{
#define C0(X, Y) X = Y
#define C1(X, Y) C0 (X##0, Y), C0 (X##1, Y | X##0), C0 (X##2, Y + X##0), C0 (X##3, Y & X##0)
#define C2(X, Y) C1 (X##0, Y), C1 (X##1, Y), C1 (X##2, Y), C1 (X##3, Y)
#define C3(X, Y) C2 (X##0, Y), C2 (X##1, Y), C2 (X##2, Y), C2 (X##3, Y)
#define A0 C3 (count, 1), x += g, C3 (count, x), x += g
#define A1 A0, A0, A0, A0, A0, A0, A0, A0
#ifdef OOM_BEFORE
#define A2 A1, A1, A1, A1
#else
#define A2 A1, A1, A1, A1, A1
#endif
  int C3 (count, 0);
  A2;
  return x;
}

int
b (int *ptr)
{
#define B0 x = f (x)
#define B1 B0, B0, B0, B0, B0, B0, B0, B0
#define B2 B1, B1, B1
  int x = 0;
  B2;
  return x;
}

  reply	other threads:[~2011-03-04 14:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 13:57 Richard Sandiford
2011-03-04 14:30 ` Richard Guenther
2011-03-04 14:47   ` Richard Sandiford [this message]
2011-03-04 14:50   ` Jakub Jelinek
2011-03-04 15:00     ` Richard Guenther
2011-03-04 15:10       ` Jakub Jelinek
2011-03-04 15:15         ` Richard Guenther
2011-03-04 15:48         ` Richard Sandiford
2011-03-04 15:22 ` Jakub Jelinek
2011-03-05 14:38   ` Richard Sandiford
2011-03-28  9:00     ` Matthias Klose
2011-04-04 10:50     ` Richard Sandiford

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=g4y64vuemp.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patches@linaro.org \
    --cc=richard.guenther@gmail.com \
    /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).