From ad90a6be219a547873beb80f977e45e23e9247ac Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Tue, 25 May 2021 15:31:38 -0700 Subject: [OpaquePtr] Create new bitcode encoding for atomicrmw Since the opaque pointer type won't contain the pointee type, we need to separately encode the value type for an atomicrmw. Emit this new code for atomicrmw. Handle this new code and the old one in the bitcode reader. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103123 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 9d4be53..ad85066 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -5232,8 +5232,10 @@ Error BitcodeReader::parseFunctionBody(Function *F) { InstructionList.push_back(I); break; } + case bitc::FUNC_CODE_INST_ATOMICRMW_OLD: case bitc::FUNC_CODE_INST_ATOMICRMW: { - // ATOMICRMW:[ptrty, ptr, val, op, vol, ordering, ssid, align?] + // ATOMICRMW_OLD: [ptrty, ptr, val, op, vol, ordering, ssid, align?] + // ATOMICRMW: [ptrty, ptr, valty, val, op, vol, ordering, ssid, align?] const size_t NumRecords = Record.size(); unsigned OpNum = 0; @@ -5245,9 +5247,14 @@ Error BitcodeReader::parseFunctionBody(Function *F) { return error("Invalid record"); Value *Val = nullptr; - if (popValue(Record, OpNum, NextValueNo, - getPointerElementFlatType(FullTy), Val)) - return error("Invalid record"); + if (BitCode == bitc::FUNC_CODE_INST_ATOMICRMW_OLD) { + if (popValue(Record, OpNum, NextValueNo, + getPointerElementFlatType(FullTy), Val)) + return error("Invalid record"); + } else { + if (getValueTypePair(Record, OpNum, NextValueNo, Val)) + return error("Invalid record"); + } if (!(NumRecords == (OpNum + 4) || NumRecords == (OpNum + 5))) return error("Invalid record"); -- cgit v1.1