Skip to content

Commit 778bf73

Browse files
woodruffwxgupta
authored andcommitted
[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
1 parent 65df10f commit 778bf73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ Error BitcodeReader::parseTypeTableBody() {
19261926
if (Record[0] == 0)
19271927
return error("Invalid vector length");
19281928
ResultTy = getTypeByID(Record[1]);
1929-
if (!ResultTy || !StructType::isValidElementType(ResultTy))
1929+
if (!ResultTy || !VectorType::isValidElementType(ResultTy))
19301930
return error("Invalid type");
19311931
bool Scalable = Record.size() > 2 ? Record[2] : false;
19321932
ResultTy = VectorType::get(ResultTy, Record[0], Scalable);

0 commit comments

Comments
 (0)