[Bitcode] Check for missing load type

We perform do this check independently of whether this is an old
or new style load.

Fixes https://github.com/llvm/llvm-project/issues/74556.
This commit is contained in:
Nikita Popov committed 2023-12-06 12:03:30 +01:00
1 parent 84e01450a3
commit 975c05b69d
1 file changed
+6 -4
+6 -4
View File
@@ -5968,10 +5968,11 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
} else {
ResTypeID = getContainedTypeID(OpTypeID);
Ty = getTypeByID(ResTypeID);
if (!Ty)
return error("Missing element type for old-style load");
}
if (!Ty)
return error("Missing load type");
if (Error Err = typeCheckLoadStoreInst(Ty, Op->getType()))
return Err;
@@ -6006,10 +6007,11 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
} else {
ResTypeID = getContainedTypeID(OpTypeID);
Ty = getTypeByID(ResTypeID);
if (!Ty)
return error("Missing element type for old style atomic load");
}
if (!Ty)
return error("Missing atomic load type");
if (Error Err = typeCheckLoadStoreInst(Ty, Op->getType()))
return Err;