aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode')
-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 c61d66f..7272951 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5231,15 +5231,18 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
unsigned OpNum = 0;
Value *Ptr = nullptr;
- if (getValueTypePair(Record, OpNum, NextValueNo, Ptr, &FullTy))
+ if (getValueTypePair(Record, OpNum, NextValueNo, Ptr))
return error("Invalid record");
if (!isa<PointerType>(Ptr->getType()))
return error("Invalid record");
Value *Val = nullptr;
- if (popValue(Record, OpNum, NextValueNo,
- getPointerElementFlatType(FullTy), Val))
+ if (popValue(Record, OpNum, NextValueNo, nullptr, Val))
+ return error("Invalid record");
+
+ if (!cast<PointerType>(Ptr->getType())
+ ->isOpaqueOrPointeeTypeMatches(Val->getType()))
return error("Invalid record");
if (!(NumRecords == (OpNum + 4) || NumRecords == (OpNum + 5)))
@@ -5272,7 +5275,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
Align(TheModule->getDataLayout().getTypeStoreSize(Val->getType()));
I = new AtomicRMWInst(Operation, Ptr, Val, *Alignment, Ordering, SSID);
- FullTy = getPointerElementFlatType(FullTy);
cast<AtomicRMWInst>(I)->setVolatile(IsVol);
InstructionList.push_back(I);