From e45cf479231fc144b4e1eb8b3e3bd2f578b6907d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 13 Dec 2022 11:58:06 +0100 Subject: [Bitcode] Remove auto-detection for typed pointers Always read bitcode according to the -opaque-pointers mode. Do not perform auto-detection to implicitly switch to typed pointers. This is a step towards removing typed pointer support, and also eliminates the class of problems where linking may fail if a typed pointer module is loaded before an opaque pointer module. (The latest place where this was encountered is D139924, but this has previously been fixed in other places doing bitcode linking as well.) Differential Revision: https://reviews.llvm.org/D139940 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 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 47b2972..0aeb1bc 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2359,8 +2359,6 @@ Error BitcodeReader::parseTypeTableBody() { if (!ResultTy || !PointerType::isValidElementType(ResultTy)) return error("Invalid type"); - if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) - Context.setOpaquePointers(false); ContainedIDs.push_back(Record[0]); ResultTy = PointerType::get(ResultTy, AddressSpace); break; @@ -2368,9 +2366,7 @@ Error BitcodeReader::parseTypeTableBody() { case bitc::TYPE_CODE_OPAQUE_POINTER: { // OPAQUE_POINTER: [addrspace] if (Record.size() != 1) return error("Invalid opaque pointer record"); - if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) { - Context.setOpaquePointers(true); - } else if (Context.supportsTypedPointers()) + if (Context.supportsTypedPointers()) return error( "Opaque pointers are only supported in -opaque-pointers mode"); unsigned AddressSpace = Record[0]; -- cgit v1.1