Instead of loading (a potential ton of) scalar constants, load those as a vector and then insert into it.
I don't know how to solve the FP cases, so I'm posting this as-is to see if anyone else has ideas or if I've just approached this in the wrong way. I stepped through the FP examples, and we show something like this:
Legalizing: t6: f32 = ConstantFP<3.000000e+00> Trying to expand node Succesfully expanded node ... replacing: t6: f32 = ConstantFP<3.000000e+00> with: t22: f32,ch = load<LD4[ConstantPool]> t0, ConstantPool:i64<float 3.000000e+00> 0, undef:i64
This doesn't happen with int constants...because int constants are legal but FP constants are not? I looked at creating target FP constants instead, but that can cause crashing for reasons I haven't tracked down yet.
Worth splatting this with UndefValue::get(EltType) ?