[llvm] 975c05b - [Bitcode] Check for missing load type

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 03:03:37 PST 2023


Author: Nikita Popov
Date: 2023-12-06T12:03:30+01:00
New Revision: 975c05b69db2d23f8d135811d46707a3802ea7fa

URL: https://github.com/llvm/llvm-project/commit/975c05b69db2d23f8d135811d46707a3802ea7fa
DIFF: https://github.com/llvm/llvm-project/commit/975c05b69db2d23f8d135811d46707a3802ea7fa.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 71417bf5086c1..1052bd4875de0 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;
 


        


More information about the llvm-commits mailing list