This is the mail archive of the gcc@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: df_insn_refs_record's handling of global_regs[]


From: David Miller <davem@davemloft.net>
Date: Tue, 16 Oct 2007 03:12:23 -0700 (PDT)

> I have a bug I'm trying to investigate where, starting in gcc-4.2.x,
> the loop invariant pass considers a computation involving a global
> register variable as invariant across a call.  The basic structure
> of the code is:

Here is the most simplified test case I could come up with,
compile it with "-m64 -Os" on sparc.  expression(regval) is
moved to before the loop by loop-invariant

register unsigned long regval asm("g5");

extern void cond_resched(void);

unsigned int var;

void *expression(unsigned long regval)
{
  void *ret;

  __asm__("" : "=r" (ret) : "0" (&var));
  return ret + regval;
}

void func(void **pp)
{
  int i;

  for (i = 0; i < 56; i++) {
    cond_resched();
    *pp = expression(regval);
  }
}


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