https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110087
--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> --- BTW: If the result of foo is random, then cmove gets badly predicted. Considering the problems with cmove on x86 (even without bad prediction), the above optimization can be quite important. Clang does it.