https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111770
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Alex Coplan from comment #4) > (In reply to Richard Biener from comment #3) > > Now, if-conversion could indeed elide the .COND_ADD for integers. It's > > problematic there only because of signed overflow undefinedness, so > > you shouldn't see it for 'unsigned' already, and adding zero is safe. > > Can you elaborate on this a bit? Do you mean to say that the .COND_ADD is > only there to avoid if-conversion introducing UB due to signed overflow? No, you are right. > ISTM it's needed for correctness even without that, as the addend needn't be > guaranteed to be zero in the general case. > > > if-conversion would need to have an idea of all the ranges involved here > > so it might be a bit sophisticated to get it right. > > Does what I suggested above make any sense, or do you have in mind a > different way of handling this in if-conversion? I'm wondering how ifcvt > should determine that the addend is zero in the case where the predicate is > false. ifcvt would need to compute said fact, say, keep a lattice of the value (or value-range) that's there when the block isn't executed (simulating a disabled vector lane). A load that's going to be replaced by a .MASK_LOAD can be then known zero and this needs to be propagated through regular stmts (like the multiply). There's also .COND_* which if-conversion could actually provide the else value for - like if we have a following division to avoid dividing by zero. But that would be propagating backwards (I'd still have this usecase in mind).