Revise scalar replacement to be more flexible about handle bitcasts and GEPs.