OSDN Git Service

[DAG] reduceBuildVecExtToExtBuildVec - don't combine if it would break a splat.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 27 Jun 2020 10:03:57 +0000 (11:03 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 27 Jun 2020 10:03:57 +0000 (11:03 +0100)
commit6bdb3ce4529ffbaad0354b052f2e9f06b4431085
tree0fd54c0bad942512e99b17938afc3ec0ae6cad6f
parent878a24d369ea4d627fb48f7af5edc28fd079a0c0
[DAG] reduceBuildVecExtToExtBuildVec - don't combine if it would break a splat.

reduceBuildVecExtToExtBuildVec was breaking a splat(zext(x)) pattern into buildvector(x, 0, x, 0, ..) resulting in much more complex insert+shuffle codegen.

We already go to some lengths to avoid this in SimplifyDemandedVectorElts etc. when we encounter splat buildvectors.

It should be OK to fold all splat(aext(x)) patterns - we might need to tighten this if we find a case where we mustn't introduce a buildvector(x, undef, x, undef, ..) but I can't find one.

Fixes PR46461.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/broadcastm-lowering.ll
llvm/test/CodeGen/X86/buildvec-insertvec.ll