[DAGCombiner] `convertBuildVecZextToBuildVecWithZeros()`: rework split factor calculation
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 2 Jan 2023 15:22:54 +0000 (18:22 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 2 Jan 2023 15:34:35 +0000 (18:34 +0300)
commit4fc417ec376cbd9646cbfd4f4c4659b4202f328e
treef4dbe52722abe31fa8637cdb638eaae57b3fac33
parentdbee45d8fea97dca9666b09688cc7548d5023c4e
[DAGCombiner] `convertBuildVecZextToBuildVecWithZeros()`: rework split factor calculation

The original computation was both making assumptions that do not hold
in practice, and being overly pessimistic. We should just check
every possible split factor, and pick the best one.

Fixes https://github.com/llvm/llvm-project/issues/59781
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/build-vector-extract.ll
llvm/test/CodeGen/X86/buildvec-insertvec.ll