aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-12-13 11:58:06 +0100
committerNikita Popov <npopov@redhat.com>2022-12-14 13:38:20 +0100
commite45cf479231fc144b4e1eb8b3e3bd2f578b6907d (patch)
tree6fd848625c2dd5f0684a3771082815372b948bfd /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentd8f91f2c1d0955da5d30ca297f2979bf6c01d8a3 (diff)
downloadllvm-e45cf479231fc144b4e1eb8b3e3bd2f578b6907d.zip
llvm-e45cf479231fc144b4e1eb8b3e3bd2f578b6907d.tar.gz
llvm-e45cf479231fc144b4e1eb8b3e3bd2f578b6907d.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp6
1 files changed, 1 insertions, 5 deletions
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];