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: GCC Status Report (2004-03-09)


And while I'm at it, there are cases where IMHO GCC should have used
RTX_UNCHANGING_P, yet it does not, there are no writes to those memory
locations at all in the whole function.

struct A { int i; int j; int k; int l; };

void baz (const struct A *a);

int __attribute__((noinline))
foo (const struct A *a)
{
  int i = a->j;
  baz (a);
  i += a->j;
  baz (a);
  i += a->j;
  baz (a);
  i += a->j;
  return i;
}

int
bar (void)
{
  const struct A a = { 1, 2, 3, 4 };
  foo (&a);
  return a.j;
}

or:

struct A { int i; const int j; int k; int l; };

void baz (struct A *a);

int __attribute__((noinline))
foo (struct A *a)
{
  int i = a->j;
  baz (a);
  i += a->j;
  baz (a);
  i += a->j;
  baz (a);
  i += a->j;
  return i;
}

int
bar (void)
{
  struct A a = { 1, 2, 3, 4 };
  foo (&a);
  return a.j;
}

or:

void baz (const int *a);

int __attribute__((noinline))
foo (const int *a)
{
  int i = *a;
  baz (a);
  i += *a;
  baz (a);
  i += *a;
  baz (a);
  i += *a;
  return i;
}

int
bar (void)
{
  const int a = 6;
  foo (&a);
  return a;
}

	Jakub


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