http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59049
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- We have <bb 4>: # iftmp.2_1 = PHI <"foo"(2), "bar"(3)> _10 = 3; _34 = g.5_8 != 1; _35 = _10 != 3; in .optimized, as fold-all-builtins manages to produce that from <bb 4>: # iftmp.2_1 = PHI <"foo"(3), "bar"(2)> _10 = strlen (iftmp.2_1); _34 = g.5_8 != 1; _35 = _10 != 3; we don't re-fold the strlen call earlier as it doesn't change (only the PHI node feeding it does!). The fact that we don't propagate string-lengths separately in CCP makes this a somewhat ill-fit for handling during the CCP propagation stage. At -O2 jump threading and the strlen pass handle it well. So indeed an oddity - probably TER simply should not forward constants to not confuse RTL expansion.