codegen: optimize handling of select_value (ifelse)
Previously, code that used `ifelse` instead of `if`,
such as seen in missing.jl, faced a massive performance penalty.
This tries to mitigate that somewhat, although using normal
`if` statements is still often preferable for good performance.