mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Canonicalize vvector_shuffle(x,x) -> vvector_shuffle(x,undef) to enable patterns
to match again :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27533 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4697,8 +4697,20 @@ SDOperand SelectionDAGLegalize::PackVectorOp(SDOperand Op,
|
||||
Result = Node->getOperand(0);
|
||||
} else {
|
||||
// Returning a BUILD_VECTOR?
|
||||
std::vector<SDOperand> Ops(Node->op_begin(), Node->op_end()-2);
|
||||
Result = DAG.getNode(ISD::BUILD_VECTOR, NewVT, Ops);
|
||||
|
||||
// If all elements of the build_vector are undefs, return an undef.
|
||||
bool AllUndef = true;
|
||||
for (unsigned i = 0, e = Node->getNumOperands()-2; i != e; ++i)
|
||||
if (Node->getOperand(i).getOpcode() != ISD::UNDEF) {
|
||||
AllUndef = false;
|
||||
break;
|
||||
}
|
||||
if (AllUndef) {
|
||||
Result = DAG.getNode(ISD::UNDEF, NewVT);
|
||||
} else {
|
||||
std::vector<SDOperand> Ops(Node->op_begin(), Node->op_end()-2);
|
||||
Result = DAG.getNode(ISD::BUILD_VECTOR, NewVT, Ops);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ISD::VINSERT_VECTOR_ELT:
|
||||
|
Reference in New Issue
Block a user