I noticed this when looking into PR 34087 with connection of a patch I wrote for loop-doloop.c which is supposed to reduce the number of instructions. Anyways the following two functions are equivalent but are not optimized that way: int f(int a) { a = -2 - a; return -(a+1); }
int f1(int a) { return a + 1; } -- Summary: ~(-2 - a) is not being optimized into a + 1 Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37516