aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2021-05-19 10:37:17 -0700
committerArthur Eubanks <aeubanks@google.com>2021-05-19 12:49:28 -0700
commit0bebda17bea38785c90a6fec3ca01cf74eb78b7c (patch)
treee81ee1e5179e0b5302771a997360aaa23df10d52 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent1b25fce404d40c6c6358037104e1e3c3aedb60ef (diff)
downloadllvm-0bebda17bea38785c90a6fec3ca01cf74eb78b7c.zip
llvm-0bebda17bea38785c90a6fec3ca01cf74eb78b7c.tar.gz
llvm-0bebda17bea38785c90a6fec3ca01cf74eb78b7c.tar.bz2
[OpaquePtr] Make atomicrmw work with opaque pointers
FullTy is only necessary when we need to figure out what type an instruction works with given a pointer's pointee type. However, we just end up using the value operand's type, so FullTy isn't necessary. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102788
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 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);