Hi, Monk Chiang

I noticed that at -O0, static functions are emitting lpad instructions, whereas
they do not at -O2. I'm not sure if this is expected behavior.

Upon further investigation, I found that c_node->only_called_directly_p() 
returns
false, which is caused by force_output being set to 1. Tracing back, I 
encountered
the following patch[1] and PR25961[2], which set force_output to 1 for static
functions at -O0, while it is 0 at -O2.

Do you have any comments on this?


Example code:

int cc = 333;
extern int aa;

__attribute__((noinline))
static void
foo(void)
{
  cc = aa;
}
int main(void)

{
  foo();
  return 0;
}

[1] https://gcc.gnu.org/legacy-ml/gcc-patches/2006-05/msg00315.html
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24561

Reply via email to