This adds a TargetLoweringBase::getSwitchConditionType callback to give targets a chance to control the type used in CodeGenPrepare::optimizeSwitchInst.
Implement callback for X86 to avoid i8 and i16 types where possible as they often incur extra zero-extensions.
This is NFC for non-X86 targets.
I'd put the "preferred" in the name itself to make the logic clear: