[llvm] [DAGCombiner] Require same type of splat & element for build_vector (PR #88284)
Feng Zou via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 20:30:08 PDT 2024
================
@@ -23429,17 +23429,21 @@ SDValue DAGCombiner::visitBUILD_VECTOR(SDNode *N) {
// TODO: Maybe this is useful for non-splat too?
if (!LegalOperations) {
if (SDValue Splat = cast<BuildVectorSDNode>(N)->getSplatValue()) {
- Splat = peekThroughBitcasts(Splat);
- EVT SrcVT = Splat.getValueType();
- if (SrcVT.isVector()) {
- unsigned NumElts = N->getNumOperands() * SrcVT.getVectorNumElements();
- EVT NewVT = EVT::getVectorVT(*DAG.getContext(),
- SrcVT.getVectorElementType(), NumElts);
- if (!LegalTypes || TLI.isTypeLegal(NewVT)) {
- SmallVector<SDValue, 8> Ops(N->getNumOperands(), Splat);
- SDValue Concat = DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(N),
- NewVT, Ops);
- return DAG.getBitcast(VT, Concat);
+ // Only change build_vector to a concat_vector if the splat value type is
----------------
fzou1 wrote:
Right. Updated.
https://github.com/llvm/llvm-project/pull/88284
More information about the llvm-commits
mailing list