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]

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


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



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