summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-09-25 15:08:33 +0000
committerSanjay Patel <spatel@rotateright.com>2019-09-25 15:08:33 +0000
commit831a7e7068f78be7108672ca6dc66721000fdf61 (patch)
tree1abede5e93e2811c2b11141b3ba5859a204246eb /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent5c3bc3c930d3993a2c5f581112c18a9eb0ba6838 (diff)
downloadbcm5719-llvm-831a7e7068f78be7108672ca6dc66721000fdf61.tar.gz
bcm5719-llvm-831a7e7068f78be7108672ca6dc66721000fdf61.zip
[DAGCombiner] add one-use restriction to vector transform with cheap extract
We might be able to do better on the example in the test, but in general, we should not scalarize a splatted vector binop if there are other uses of the binop. Otherwise, we can end up with code as we had - a scalar op that is redundant with a vector op. llvm-svn: 372886
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 2b47407393d..80afbbee1b1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -18990,7 +18990,7 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE(SDNode *N) {
// build_vector.
if (SVN->isSplat() && SVN->getSplatIndex() < (int)NumElts) {
int SplatIndex = SVN->getSplatIndex();
- if (TLI.isExtractVecEltCheap(VT, SplatIndex) &&
+ if (N0.hasOneUse() && TLI.isExtractVecEltCheap(VT, SplatIndex) &&
TLI.isBinOp(N0.getOpcode()) && N0.getNode()->getNumValues() == 1) {
// splat (vector_bo L, R), Index -->
// splat (scalar_bo (extelt L, Index), (extelt R, Index))
OpenPOWER on IntegriCloud