[tree-ssa] Too conservative optimization with global variables??

Steven Bosscher s.bosscher@student.tudelft.nl
Mon Jun 16 11:30:00 GMT 2003


Consider:

extern int c;

void fubar (void)
{
  int a, b;

  a = 1; b = 2; c = 3;
  c = a * b * c;
}

With -O1 and -O2 this optimizes to (t15.optimized dump):

;; Function fubar (fubar)

fubar()
{
  int T.1;
  int a;
  int b;

  c = 3;
  c = c * 2;
}

Why can't this just be folded to "c = 6;"?

Gr.
Steven




More information about the Gcc mailing list