core: fix selects in optimized rvalue expressions