Minimize usage of matchToIfThenElse in CodeGen