aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-12-06 11:59:57 +0100
committerNikita Popov <npopov@redhat.com>2023-12-06 12:03:30 +0100
commit975c05b69db2d23f8d135811d46707a3802ea7fa (patch)
tree5f40312eb48751c8c79abc428fe4fb08ff1e3792 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent84e01450a30eabab571103d2f1195565c0ab851a (diff)
downloadllvm-975c05b69db2d23f8d135811d46707a3802ea7fa.zip
llvm-975c05b69db2d23f8d135811d46707a3802ea7fa.tar.gz
llvm-975c05b69db2d23f8d135811d46707a3802ea7fa.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 71417bf..1052bd4 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -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;