diff options
author | william woodruff <william@yossarian.net> | 2021-10-09 08:59:45 +0530 |
---|---|---|
committer | Shivam Gupta <shivam98.tkg@gmail.com> | 2021-10-09 09:42:02 +0530 |
commit | 778bf73d7ba693f4bb74d137a70870bce128a19f (patch) | |
tree | 693e84ee3c837d81e8a9a99c15c86cc5fffca0fd | |
parent | 65df10f3cd66abeab848990871885f33a4f980ac (diff) | |
download | llvm-778bf73d7ba693f4bb74d137a70870bce128a19f.zip llvm-778bf73d7ba693f4bb74d137a70870bce128a19f.tar.gz llvm-778bf73d7ba693f4bb74d137a70870bce128a19f.tar.bz2 |
[BitcodeReader] fix a logic error in vector type element validation
The current code checks whether the vector's element type is a valid structure element type, rather than a valid vector element type. The two have separate implementations and but only accept very slightly different sets of types, which is probably why this wasn't caught before.
Differential Revision: https://reviews.llvm.org/D109655
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index f5503d6..b3df3a7 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1926,7 +1926,7 @@ Error BitcodeReader::parseTypeTableBody() { if (Record[0] == 0) return error("Invalid vector length"); ResultTy = getTypeByID(Record[1]); - if (!ResultTy || !StructType::isValidElementType(ResultTy)) + if (!ResultTy || !VectorType::isValidElementType(ResultTy)) return error("Invalid type"); bool Scalable = Record.size() > 2 ? Record[2] : false; ResultTy = VectorType::get(ResultTy, Record[0], Scalable); |