https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111560
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Severity|normal |enhancement --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The problem is in this case: e=a+b+c; //line 5 f=d+b+c; //"b+c" can be replaced with the value at line 5 at the gimple level, b+c could introduce an signed integer overflow. And we don't want to introduce that. If you had used unsigned, rather than int, the optimization would have been done as we do reassociate unsigned integers just fine.