I was debug stepping through an x86 shuffle lowering and noticed we were doing an N^2 search for splat index. I didn't find the equivalent functionality anywhere else in LLVM, so here's a helper that takes an array of int and returns a splatted index while ignoring undefs (any negative value).
This might also be used inside existing ShuffleVectorInst/ShuffleVectorSDNode functions and/or help with D72467.