[PATCH] D83882: [Legalize] Hoist invariant condition in ExpandVectorBuildThroughStack(...)

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 09:05:53 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGae51a70030b5: [Legalize] Hoist invariant condition in ExpandVectorBuildThroughStack(...) (authored by cameron.mcinally).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83882/new/

https://reviews.llvm.org/D83882

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1411,6 +1411,12 @@
   SmallVector<SDValue, 8> Stores;
   unsigned TypeByteSize = MemVT.getSizeInBits() / 8;
   assert(TypeByteSize > 0 && "Vector element type too small for stack store!");
+
+  // If the destination vector element type of a BUILD_VECTOR is narrower than
+  // the source element type, only store the bits necessary.
+  bool Truncate = isa<BuildVectorSDNode>(Node) &&
+                  MemVT.bitsLT(Node->getOperand(0).getValueType());
+
   // Store (in the right endianness) the elements to memory.
   for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
     // Ignore undef elements.
@@ -1420,9 +1426,7 @@
 
     SDValue Idx = DAG.getMemBasePlusOffset(FIPtr, Offset, dl);
 
-    // If the destination vector element type is narrower than the source
-    // element type, only store the bits necessary.
-    if (MemVT.bitsLT(Node->getOperand(i).getValueType()))
+    if (Truncate)
       Stores.push_back(DAG.getTruncStore(DAG.getEntryNode(), dl,
                                          Node->getOperand(i), Idx,
                                          PtrInfo.getWithOffset(Offset), MemVT));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83882.278213.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/86dd4669/attachment.bin>


More information about the llvm-commits mailing list