summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2015-08-23 15:22:14 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2015-08-23 15:22:14 +0000
commit2a7049abe0ad0ff5c92386fad3cbc90f65cb6788 (patch)
treee807fc92d7d16718397b0cebe70ecfec021a92e0 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent5e3f9ff87dd0d10090fa8aed52e0fc16f43de14c (diff)
downloadbcm5719-llvm-2a7049abe0ad0ff5c92386fad3cbc90f65cb6788.tar.gz
bcm5719-llvm-2a7049abe0ad0ff5c92386fad3cbc90f65cb6788.zip
[DAGCombiner] Fold CONCAT_VECTORS of bitcasted EXTRACT_SUBVECTOR
Minor generalization of D12125 - peek through any bitcast to the original vector that we're extracting from. llvm-svn: 245814
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index ab3a6631d33..607c3bf2336 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2285,7 +2285,7 @@ SDValue DAGCombiner::visitUDIV(SDNode *N) {
}
}
}
-
+
// fold (udiv x, c) -> alternate
bool MinSize = DAG.getMachineFunction().getFunction()->optForMinSize();
if (N1C && !TLI.isIntDivCheap(N->getValueType(0), MinSize))
@@ -12270,12 +12270,21 @@ static SDValue combineConcatVectorOfExtracts(SDNode *N, SelectionDAG &DAG) {
// What vector are we extracting the subvector from and at what index?
SDValue ExtVec = Op.getOperand(0);
+
+ // We want the EVT of the original extraction to correctly scale the
+ // extraction index.
+ EVT ExtVT = ExtVec.getValueType();
+
+ // Peek through any bitcast.
+ while (ExtVec.getOpcode() == ISD::BITCAST)
+ ExtVec = ExtVec.getOperand(0);
+
+ // UNDEF nodes convert to UNDEF shuffle mask values.
if (ExtVec.getOpcode() == ISD::UNDEF) {
Mask.append((unsigned)NumOpElts, -1);
continue;
}
- EVT ExtVT = ExtVec.getValueType();
if (!isa<ConstantSDNode>(Op.getOperand(1)))
return SDValue();
int ExtIdx = cast<ConstantSDNode>(Op.getOperand(1))->getZExtValue();
OpenPOWER on IntegriCloud