https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85406
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|WAITING |NEW Blocks| |53947 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- I think it's too much asked from GCC to prove that if a == 255 the computation in the else path would result in x. The simplest fix would be to remove the conditional in the source. It's true that GCC doesn't evaluate costs of the vectorization properly as it looks at the if-converted copy when calculating the cost of the scalar loop. OTOH any estimate on how often the shortcut triggers compared to the computation might be off and a conservative estimate may cause us to not vectorize and thus slow down the code. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations