diff options
author | Craig Topper <craig.topper@sifive.com> | 2021-01-17 23:29:43 -0800 |
---|---|---|
committer | Craig Topper <craig.topper@sifive.com> | 2021-01-17 23:29:51 -0800 |
commit | cfec6cd50c36f3db2fcd4084a8ef4df834a4eb24 (patch) | |
tree | b737cb42f914451b94b151fec5ab0c0729b096bb /llvm/lib/IR/DataLayout.cpp | |
parent | bcc1dee60019f3a488a04dc7f701f7a692040fed (diff) | |
download | llvm-cfec6cd50c36f3db2fcd4084a8ef4df834a4eb24.zip llvm-cfec6cd50c36f3db2fcd4084a8ef4df834a4eb24.tar.gz llvm-cfec6cd50c36f3db2fcd4084a8ef4df834a4eb24.tar.bz2 |
[IR] Allow scalable vectors in structs to support intrinsics returning multiple values.
RISC-V would like to use a struct of scalable vectors to return multiple
values from intrinsics. This woud also be needed for target independent
intrinsics like llvm.sadd.overflow.
This patch removes the existing restriction for this. I've modified
StructType::isSized to consider a struct containing scalable vectors
as unsized so the verifier won't allow loads/stores/allocas of these
structs.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D94142
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index 2080557..274ea0a 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -65,7 +65,8 @@ StructLayout::StructLayout(StructType *ST, const DataLayout &DL) { StructAlignment = std::max(TyAlign, StructAlignment); MemberOffsets[i] = StructSize; - StructSize += DL.getTypeAllocSize(Ty); // Consume space for this data item + // Consume space for this data item + StructSize += DL.getTypeAllocSize(Ty).getFixedValue(); } // Add padding to the end of the struct so that it could be put in an array |