diff options
| author | Nadav Rotem <nadav.rotem@intel.com> | 2012-07-14 21:30:27 +0000 |
|---|---|---|
| committer | Nadav Rotem <nadav.rotem@intel.com> | 2012-07-14 21:30:27 +0000 |
| commit | 018921002e9ffd421da2a2c7a1597ec13da9d200 (patch) | |
| tree | fbb55a6657ad1d731f9fb6e2f3c6b3e1c060c62a /llvm/lib/CodeGen/SelectionDAG | |
| parent | 934a1c02312af4a45693815513c3cfb110ff67db (diff) | |
| download | bcm5719-llvm-018921002e9ffd421da2a2c7a1597ec13da9d200.tar.gz bcm5719-llvm-018921002e9ffd421da2a2c7a1597ec13da9d200.zip | |
Add a dagcombine optimization to convert concat_vectors of undefs into a single undef.
The unoptimized concat_vectors isd prevented the canonicalization of the vector_shuffle node.
llvm-svn: 160221
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index e2c7dec40c7..1e87d5184f2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -7816,6 +7816,17 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) { if (N->getNumOperands() == 1) return N->getOperand(0); + // Check if all of the operands are undefs. + bool AllUndef = true; + for (unsigned i = 0; i < N->getNumOperands(); ++i) + if (N->getOperand(i).getOpcode() != ISD::UNDEF) { + AllUndef = false; + break; + } + + if (AllUndef) + return DAG.getUNDEF(N->getValueType(0)); + return SDValue(); } |

