summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/SystemZ
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-11-09 15:44:28 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-11-09 15:44:28 +0000
commit458b7c0b398241961be5620e1b6a7d17444ae645 (patch)
tree74d05ae1c1a83d470e9bd4a5aedb26ccb32a2a8c /llvm/lib/Target/SystemZ
parent9ac2f7a1f826b0b72e6d86836d523808eaa3563c (diff)
downloadbcm5719-llvm-458b7c0b398241961be5620e1b6a7d17444ae645.tar.gz
bcm5719-llvm-458b7c0b398241961be5620e1b6a7d17444ae645.zip
[SystemZ] Avoid inserting same value after replication
A minor improvement of buildVector() that skips creating an INSERT_VECTOR_ELT for a Value which has already been used for the REPLICATE. Review: Ulrich Weigand https://reviews.llvm.org/D54315 llvm-svn: 346504
Diffstat (limited to 'llvm/lib/Target/SystemZ')
-rw-r--r--llvm/lib/Target/SystemZ/SystemZISelLowering.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index d2c33546716..71b7af2b025 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -4479,6 +4479,7 @@ static SDValue buildVector(SelectionDAG &DAG, const SDLoc &DL, EVT VT,
// Constants with undefs to get a full vector constant and use that
// as the starting point.
SDValue Result;
+ SDValue ReplicatedVal;
if (NumConstants > 0) {
for (unsigned I = 0; I < NumElements; ++I)
if (!Constants[I].getNode())
@@ -4500,6 +4501,7 @@ static SDValue buildVector(SelectionDAG &DAG, const SDLoc &DL, EVT VT,
if (LoadElIdx != UINT_MAX) {
Result = DAG.getNode(SystemZISD::REPLICATE, DL, VT, Elems[LoadElIdx]);
Done[LoadElIdx] = true;
+ ReplicatedVal = Elems[LoadElIdx];
} else {
// Try to use VLVGP.
unsigned I1 = NumElements / 2 - 1;
@@ -4520,7 +4522,7 @@ static SDValue buildVector(SelectionDAG &DAG, const SDLoc &DL, EVT VT,
// Use VLVGx to insert the other elements.
for (unsigned I = 0; I < NumElements; ++I)
- if (!Done[I] && !Elems[I].isUndef())
+ if (!Done[I] && !Elems[I].isUndef() && Elems[I] != ReplicatedVal)
Result = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, VT, Result, Elems[I],
DAG.getConstant(I, DL, MVT::i32));
return Result;
OpenPOWER on IntegriCloud