This patch fixes the following issues in visitInsertElementInst:
- Bail out for scalable type when analysis requires fixed size number of vector elements.
- Use cast<FixedVectorType> to get vector number of elements. This ensure assertion on scalable vector type.
- For scalable type, avoid folding a chain of insertelement into splat: insertelt(insertelt(insertelt(insertelt X, %k, 0), %k, 1), %k, 2) ... -> shufflevector(insertelt(X, %k, 0), undef, zero) The length of scalable vector is unknown at compile-time, therefore we don't know if given insertelement sequence is valid for splat.
I'd prefer to bail out more aggressively here; I'm not sure this makes sense for scalable vectors.