I'm somewhat confident about my fix on its own, but I'm not at all familiar with vector instructions. Since I had to modify existing tests, please take a look. :)
Bug: MaxIndex represents the maximum index we're passing to ShuffleVector. If it's a power of two, we can end up splitting into two vectors which have a total size == MaxIndex. This caused an assertion failure in SelectionDAG::getVectorShuffle:
Assertion `llvm::all_of(Mask, [&](int M) { return M < (NElts * 2); }) && "Index out of range"' failed
(NElts == 4, and Mask == {0, 8, -1, -1})