diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-06-17 10:14:52 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-06-17 10:14:52 +0000 |
commit | ef78e55205e1c7a66d7b229bb282f3bf35ea3cba (patch) | |
tree | 0565a0d59aff8602c02d75f2309b6ac777c3656f /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 9d81915fcaab6ba4f51e4f5415834aed1924a72e (diff) | |
download | bcm5719-llvm-ef78e55205e1c7a66d7b229bb282f3bf35ea3cba.tar.gz bcm5719-llvm-ef78e55205e1c7a66d7b229bb282f3bf35ea3cba.zip |
[SelectionDAG] Fold insert_subvector(undef, extract_subvector(v, c), c) -> v in getNode
This is already done in DAGCombiner::visitINSERT_SUBVECTOR, but this helps a number of shuffles across different vector widths recognise when they come from the same source.
llvm-svn: 363542
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 224265dfee5..fea8d7ad894 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5539,6 +5539,12 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT, // Trivial insertion. if (VT.getSimpleVT() == N2.getSimpleValueType()) return N2; + + // If this is an insert of an extracted vector into an undef vector, we + // can just use the input to the extract. + if (N1.isUndef() && N2.getOpcode() == ISD::EXTRACT_SUBVECTOR && + N2.getOperand(1) == N3 && N2.getOperand(0).getValueType() == VT) + return N2.getOperand(0); } break; } |