http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54571
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-09-14 Version|unknown |4.8.0 Ever Confirmed|0 |1 --- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-14 08:39:42 UTC --- Confirmed. The natural place to optimize this is the tree level phiopt pass. <bb 2>: _3 = x_2(D) & 2; if (_3 != 0) goto <bb 3>; else goto <bb 4>; <bb 3>: y_5 = y_4(D) | 1; <bb 4>: # y_1 = PHI <y_4(D)(2), y_5(3)> where we should handle int f1(int x, int y, int d) { int tem; if ((tem = x & d)) y |= tem; return y; } as well. Yes, that's just y |= x & d, but it falls out naturally if the transform is implemented in a generic enough way.