diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -254,6 +254,7 @@ - The CodeGen flag `-lower-global-dtors-via-cxa-atexit` which affects how global destructors are lowered for MachO is removed without replacement. The default of `-lower-global-dtors-via-cxa-atexit=true` is now the only supported way. +- The cc1 flag ``-no-opaque-pointers`` has been removed. Attribute Changes in Clang -------------------------- diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -501,9 +501,6 @@ ENUM_CODEGENOPT(ZeroCallUsedRegs, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind, 5, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Skip) -/// Whether to use opaque pointers. -CODEGENOPT(OpaquePointers, 1, 0) - /// Modify C++ ABI to returning `this` pointer from constructors and /// non-deleting destructors. (No effect on Microsoft ABI.) CODEGENOPT(CtorDtorReturnThis, 1, 0) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6029,13 +6029,6 @@ PosFlag, NegFlag, BothFlags<[], " analyzing function argument and return types for mandatory definedness">>; -defm opaque_pointers : BoolOption<"", - "opaque-pointers", - CodeGenOpts<"OpaquePointers">, - DefaultTrue, - PosFlag, - NegFlag, - BothFlags<[], " opaque pointers">>; def discard_value_names : Flag<["-"], "discard-value-names">, HelpText<"Discard value names in LLVM IR">, MarshallingInfoFlag>; diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -1047,8 +1047,6 @@ if (BA != Backend_EmitNothing && !OS) return nullptr; - VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers); - // Load bitcode modules to link with, if we need to. if (LinkModules.empty()) for (const CodeGenOptions::BitcodeFileToLink &F : @@ -1106,8 +1104,6 @@ CompilerInstance &CI = getCompilerInstance(); SourceManager &SM = CI.getSourceManager(); - VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers); - // For ThinLTO backend invocations, ensure that the context // merges types based on ODR identifiers. We also need to read // the correct module out of a multi-module bitcode file. diff --git a/clang/test/CodeGen/opaque-pointers-flag.c b/clang/test/CodeGen/opaque-pointers-flag.c deleted file mode 100644 --- a/clang/test/CodeGen/opaque-pointers-flag.c +++ /dev/null @@ -1,25 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED -// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=OPAQUE - -// TYPED-LABEL: @test( -// TYPED-NEXT: entry: -// TYPED-NEXT: [[P_ADDR:%.*]] = alloca ptr, align 8 -// TYPED-NEXT: store ptr [[P:%.*]], ptr [[P_ADDR]], align 8 -// TYPED-NEXT: [[TMP0:%.*]] = load ptr, ptr [[P_ADDR]], align 8 -// TYPED-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1 -// TYPED-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -// TYPED-NEXT: ret i32 [[TMP1]] -// -// OPAQUE-LABEL: @test( -// OPAQUE-NEXT: entry: -// OPAQUE-NEXT: [[P_ADDR:%.*]] = alloca ptr, align 8 -// OPAQUE-NEXT: store ptr [[P:%.*]], ptr [[P_ADDR]], align 8 -// OPAQUE-NEXT: [[TMP0:%.*]] = load ptr, ptr [[P_ADDR]], align 8 -// OPAQUE-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1 -// OPAQUE-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -// OPAQUE-NEXT: ret i32 [[TMP1]] -// -int test(int *p) { - return p[1]; -} diff --git a/clang/test/CodeGenOpenCL/opaque-ptr-spirv.cl b/clang/test/CodeGenOpenCL/opaque-ptr-spirv.cl deleted file mode 100644 --- a/clang/test/CodeGenOpenCL/opaque-ptr-spirv.cl +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm -o - -triple spirv64 %s | FileCheck %s - -// Check that we have a way to recover pointer -// types for extern function prototypes (see PR56660). -extern void foo(global int * ptr); -kernel void k(global int * ptr) { - foo(ptr); -} -//CHECK: define spir_kernel void @k(i32 {{.*}}* -//CHECK: declare spir_func void @foo(i32 {{.*}}* diff --git a/llvm/docs/OpaquePointers.rst b/llvm/docs/OpaquePointers.rst --- a/llvm/docs/OpaquePointers.rst +++ b/llvm/docs/OpaquePointers.rst @@ -289,6 +289,8 @@ The following typed pointer functionality has already been removed: * The ``CLANG_ENABLE_OPAQUE_POINTERS`` cmake flag is no longer supported. +* The ``-no-opaque-pointers`` cc1 clang flag is no longer supported. +* The ``-plugin-opt=no-opaque-pointers`` LTO flag is no longer supported. * C APIs that do not support opaque pointers (like ``LLVMBuildLoad``) are no longer supported. * Typed pointer IR and bitcode is implicitly upgraded to use opaque pointers, @@ -296,6 +298,5 @@ The following typed pointer functionality is still to be removed: -* The ``-no-opaque-pointers`` cc1 flag, ``-opaque-pointers=0`` opt flag and - ``-plugin-opt=no-opaque-pointers`` lto flag. +* The ``-opaque-pointers=0`` opt flag. * Support for typed pointers in LLVM libraries.