This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/16157] gcc fails to optimize redundant expression (reassocation)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16157

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-04 00:06:13 UTC ---
If we rewrite the code to be:
extern int a0, a1, a2, a3, a4;
extern int b0, b1, b2, b3, b4;
void f ()
{
        /* this can be optimized to four additions... */
        b4 = a4 + (a3 + (a2 + (a1 + a0)));
        b3 = a3 + (a2 + (a1 + a0));
        b2 = a2 + (a1 + a0);
        b1 = a1 + a0;
}

Then it gets optimized.


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