This is the minimum patch needed to solve the missed SRA fold that was noted in:
https://reviews.llvm.org/D25485
and partially fixed with:
https://reviews.llvm.org/rL284395
Of course, we could move more of the related analysis functions in DAGCombiner that are currently static/local to have a more unified approach.
Ie, move all of these (some were recently added in D25374)?
isConstantFPBuildVectorOrConstantFP
isConstOrConstSplatFP
isConstantOrConstantVector
isNullConstantOrNullSplatConstant
isOneConstantOrOneSplatConstant
isAllOnesConstantOrAllOnesSplatConstant
It's not clear to me exactly where the handling of undef elements is different and where that is intentional.
Might this be a good time to add an 'AllowUndefs' argument so that we permit cases where there is at least one ConstantSDNode in the splat but other elements can be UNDEF.