http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51938
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |missed-optimization Last reconfirmed| |2012-01-23 Component|tree-optimization |rtl-optimization Ever Confirmed|0 |1 Severity|normal |enhancement --- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-23 10:23:31 UTC --- Confirmed. Something for PHI-OPT, recognize <bb 2>: if (x_2(D) > 0.0) goto <bb 5>; else goto <bb 3>; <bb 3>: if (x_2(D) < 0.0) goto <bb 4>; else goto <bb 5>; <bb 4>: <bb 5>: # D.1719_1 = PHI <1(2), -1(4), 0(3)> return D.1719_1; I suspect also worthwhile for integral types. Note that for real types you need -ffinite-math-only - I bet the clang result is wrong for NaNs. Btw, what's the optimal assembly you expect? Not sure what's the best way to represent this on the tree level either, so eventually we have to resort to RTL if-conversion (doesn't work there for integral types either).