When evaluating constexpr vector splats, we weren't doing appropriate type conversions on the literal we were splatting, causing assertion failures in cases like:
void foo(vector float FloatInput, vector short ShortInput) {
(void)(FloatInput == (vector float)0); // OK
(void)(ShortInput == (vector short)0); // OK
constexpr vector float Floats = (vector float)0;
(void)(FloatInput == Floats); // ICE -- fcmp between [4 x i32] and [4 x f32]
constexpr vector short Shorts = (vector short)0;
(void)(ShortInput == Shorts); // ICE -- fcmp between vec of i16 and vec of i32
}(The same issue applied for cases like (vector short)0; it would be lowered as a vector of i32.)
This patch fixes these in ExprConstant rather than CodeGen, because it allows us to more sanely model overflow/complain to the user/... in the evaluator.
This patch also contains a few generic code cleanliness changes. I'm happy to drop any/all of them if we decide they're not helpful. :)