[PATCH] D91834: [SelectionDAG] Use TypeSize for the stack offset.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 3 18:31:04 PST 2021


HsiangKai updated this revision to Diff 314310.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91834

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
@@ -1433,8 +1433,9 @@
 
   // Emit a store of each element to the stack slot.
   SmallVector<SDValue, 8> Stores;
-  unsigned TypeByteSize = MemVT.getSizeInBits() / 8;
-  assert(TypeByteSize > 0 && "Vector element type too small for stack store!");
+  TypeSize TypeByteSize = MemVT.getStoreSize();
+  assert(TypeByteSize.getKnownMinSize() > 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.
@@ -1446,9 +1447,9 @@
     // Ignore undef elements.
     if (Node->getOperand(i).isUndef()) continue;
 
-    unsigned Offset = TypeByteSize*i;
+    TypeSize Offset = TypeByteSize * i;
 
-    SDValue Idx = DAG.getMemBasePlusOffset(FIPtr, TypeSize::Fixed(Offset), dl);
+    SDValue Idx = DAG.getMemBasePlusOffset(FIPtr, Offset, dl);
 
     if (Truncate)
       Stores.push_back(DAG.getTruncStore(DAG.getEntryNode(), dl,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91834.314310.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210104/e7a40ddb/attachment.bin>


More information about the llvm-commits mailing list