http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45685
--- Comment #26 from Jeffrey A. Law <law at redhat dot com> --- Looking at this again, I think there's another solution. Basically we've got conditional negation occurring in both loops. There's a reasonably good sequence to turn that into straight line code. result = (input ^ -cond) + cond Will negate the input when cond is true. It looks a bit ugly, but significantly helps simplify the first loop where we go from 23 insns down to just 18 insns. It helps the second loop as well, but the results aren't as dramatic. >From an implementation standpoint, it fits quite well into the existing phi-opt code structure.