summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp6
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
2 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 49de70e26de..c33fc568abe 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1775,7 +1775,8 @@ Error BitcodeReader::parseTypeTableBody() {
return error("Invalid type");
ResultTy = ArrayType::get(ResultTy, Record[0]);
break;
- case bitc::TYPE_CODE_VECTOR: // VECTOR: [numelts, eltty]
+ case bitc::TYPE_CODE_VECTOR: // VECTOR: [numelts, eltty] or
+ // [numelts, eltty, scalable]
if (Record.size() < 2)
return error("Invalid record");
if (Record[0] == 0)
@@ -1783,7 +1784,8 @@ Error BitcodeReader::parseTypeTableBody() {
ResultTy = getTypeByID(Record[1]);
if (!ResultTy || !StructType::isValidElementType(ResultTy))
return error("Invalid type");
- ResultTy = VectorType::get(ResultTy, Record[0]);
+ bool Scalable = Record.size() > 2 ? Record[2] : false;
+ ResultTy = VectorType::get(ResultTy, Record[0], Scalable);
break;
}
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 1f39fa34a8b..1cf55ba813a 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -938,10 +938,13 @@ void ModuleBitcodeWriter::writeTypeTable() {
}
case Type::VectorTyID: {
VectorType *VT = cast<VectorType>(T);
- // VECTOR [numelts, eltty]
+ // VECTOR [numelts, eltty] or
+ // [numelts, eltty, scalable]
Code = bitc::TYPE_CODE_VECTOR;
TypeVals.push_back(VT->getNumElements());
TypeVals.push_back(VE.getTypeID(VT->getElementType()));
+ if (VT->isScalable())
+ TypeVals.push_back(VT->isScalable());
break;
}
}
OpenPOWER on IntegriCloud