[PATCH] D87708: [DAG] Remove DAGTypeLegalizer::GenWidenVectorTruncStores (PR42046)
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 03:19:54 PDT 2020
RKSimon updated this revision to Diff 293012.
RKSimon retitled this revision from "[DAG] DAGTypeLegalizer::GenWidenVectorTruncStores - ensure correct extraction index (PR42046)" to "[DAG] Remove DAGTypeLegalizer::GenWidenVectorTruncStores (PR42046)".
RKSimon edited the summary of this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.
Replace GenWidenVectorTruncStores with scalarizeVectorStore
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87708/new/
https://reviews.llvm.org/D87708
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -4580,11 +4580,11 @@
if (!ST->getMemoryVT().getScalarType().isByteSized())
return TLI.scalarizeVectorStore(ST, DAG);
- SmallVector<SDValue, 16> StChain;
if (ST->isTruncatingStore())
- GenWidenVectorTruncStores(StChain, ST);
- else
- GenWidenVectorStores(StChain, ST);
+ return TLI.scalarizeVectorStore(ST, DAG);
+
+ SmallVector<SDValue, 16> StChain;
+ GenWidenVectorStores(StChain, ST);
if (StChain.size() == 1)
return StChain[0];
@@ -5225,54 +5225,6 @@
}
}
-void
-DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVectorImpl<SDValue> &StChain,
- StoreSDNode *ST) {
- // For extension loads, it may not be more efficient to truncate the vector
- // and then store it. Instead, we extract each element and then store it.
- SDValue Chain = ST->getChain();
- SDValue BasePtr = ST->getBasePtr();
- MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
- AAMDNodes AAInfo = ST->getAAInfo();
- SDValue ValOp = GetWidenedVector(ST->getValue());
- SDLoc dl(ST);
-
- EVT StVT = ST->getMemoryVT();
- EVT ValVT = ValOp.getValueType();
-
- // It must be true that the wide vector type is bigger than where we need to
- // store.
- assert(StVT.isVector() && ValOp.getValueType().isVector());
- assert(StVT.isScalableVector() == ValOp.getValueType().isScalableVector());
- assert(StVT.bitsLT(ValOp.getValueType()));
-
- if (StVT.isScalableVector())
- report_fatal_error("Generating widen scalable vector truncating stores not "
- "yet supported");
-
- // For truncating stores, we can not play the tricks of chopping legal vector
- // types and bitcast it to the right type. Instead, we unroll the store.
- EVT StEltVT = StVT.getVectorElementType();
- EVT ValEltVT = ValVT.getVectorElementType();
- unsigned Increment = ValEltVT.getSizeInBits() / 8;
- unsigned NumElts = StVT.getVectorNumElements();
- SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
- DAG.getVectorIdxConstant(0, dl));
- StChain.push_back(
- DAG.getTruncStore(Chain, dl, EOp, BasePtr, ST->getPointerInfo(), StEltVT,
- ST->getOriginalAlign(), MMOFlags, AAInfo));
- unsigned Offset = Increment;
- for (unsigned i=1; i < NumElts; ++i, Offset += Increment) {
- SDValue NewBasePtr =
- DAG.getObjectPtrOffset(dl, BasePtr, TypeSize::Fixed(Offset));
- SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
- DAG.getVectorIdxConstant(0, dl));
- StChain.push_back(DAG.getTruncStore(
- Chain, dl, EOp, NewBasePtr, ST->getPointerInfo().getWithOffset(Offset),
- StEltVT, ST->getOriginalAlign(), MMOFlags, AAInfo));
- }
-}
-
/// Modifies a vector input (widen or narrows) to a vector of NVT. The
/// input vector must have the same element type as NVT.
/// FillWithZeroes specifies that the vector should be widened with zeroes.
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -944,13 +944,6 @@
/// ST: store of a widen value
void GenWidenVectorStores(SmallVectorImpl<SDValue> &StChain, StoreSDNode *ST);
- /// Helper function to generate a set of stores to store a truncate widen
- /// vector into non-widen memory.
- /// StChain: list of chains for the stores we have generated
- /// ST: store of a widen value
- void GenWidenVectorTruncStores(SmallVectorImpl<SDValue> &StChain,
- StoreSDNode *ST);
-
/// Modifies a vector input (widen or narrows) to a vector of NVT. The
/// input vector must have the same element type as NVT.
/// When FillWithZeroes is "on" the vector will be widened with zeroes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87708.293012.patch
Type: text/x-patch
Size: 4149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200920/b0a54f52/attachment.bin>
More information about the llvm-commits
mailing list