This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [2/2] Reducing the overhead of dwarf2 location tracking


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]