Handle the fallout in the various backends that use this
It's possible to do shufflevector on scalable vectors if you jump through some hoops. For instance, you can make a splat if you insertelement the splat value into the zeroeth element of undef, then shufflevector the result of that with undef and zeroinitializer as the mask. There's an RFC to extend shufflevector on scalable vectors: http://lists.llvm.org/pipermail/llvm-dev/2020-January/138762.html. It hasn't been updated in a while, but it's not dead, just dormant.
For now, the plan is to assume all usages of getNumElements are in fact fixed-width operations. If the assumption is incorrect, LLVM will fail to cast right away, rather than miscompile or blow up 10 functions down the line.
It actually is. RetTy is a Type * and getScalarizationOverhead calls FixedVectorType::getNumElements().
It looks like the type returned by ICA.getReturnType() might be void, so we can't assign it to a FixedVectorType *.
After spending time trying to debug this test failure, I had some time to reflect on my approach. I have decided that changing the interface to explicitly work on FixedVectorType would be a mistake. Many or all of these operations should be possible for scalable vectors. The fact that they don't work is an issue to be fixed, and not a feature. With that in mind, I will abandon this patch in favor of D81495 which just does the cast internally and does not change the interface.