diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1433,8 +1433,9 @@ // Emit a store of each element to the stack slot. SmallVector 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,