[all-commits] [llvm/llvm-project] 90ec6d: [OpaquePtr] Forbid mixing typed and opaque pointers

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Sep 10 06:20:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 90ec6dff860f4ec9cb89041b6e2a671cc3ce8f47
      https://github.com/llvm/llvm-project/commit/90ec6dff860f4ec9cb89041b6e2a671cc3ce8f47
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-09-10 (Fri, 10 Sep 2021)

  Changed paths:
    M llvm/include/llvm/AsmParser/LLParser.h
    M llvm/include/llvm/IR/LLVMContext.h
    M llvm/lib/AsmParser/LLLexer.cpp
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/IR/Function.cpp
    M llvm/lib/IR/LLVMContext.cpp
    M llvm/lib/IR/LLVMContextImpl.cpp
    M llvm/lib/IR/LLVMContextImpl.h
    M llvm/lib/IR/Type.cpp
    M llvm/test/Assembler/invalid-opaque-ptr-addrspace.ll
    M llvm/test/Assembler/invalid-opaque-ptr-double-addrspace.ll
    M llvm/test/Assembler/invalid-opaque-ptr.ll
    M llvm/test/Assembler/opaque-ptr-cmpxchg.ll
    M llvm/test/Assembler/opaque-ptr.ll
    A llvm/test/Assembler/ptr-outside-opaque-pointers-mode.ll
    R llvm/test/Assembler/remangle-intrinsic-opaque-ptr.ll
    M llvm/test/CodeGen/AArch64/consthoist-gep.ll
    M llvm/test/CodeGen/AArch64/sve-vscale.ll
    M llvm/test/CodeGen/BPF/CORE/intrinsic-array.ll
    M llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-ind32-scaled.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-ind32-unscaled.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-ptrs.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-scatter-optimisation.ll
    M llvm/test/CodeGen/Thumb2/mve-scatter-increment.ll
    M llvm/test/CodeGen/Thumb2/mve-scatter-ptrs.ll
    M llvm/test/CodeGen/WebAssembly/add-prototypes-opaque-ptrs.ll
    M llvm/test/CodeGen/WebAssembly/function-bitcasts.ll
    M llvm/test/CodeGen/WebAssembly/main-declaration.ll
    M llvm/test/Instrumentation/SanitizerCoverage/opaque-ptr.ll
    M llvm/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll
    M llvm/test/Other/force-opaque-ptrs-typed-dis.ll
    M llvm/test/Other/force-opaque-ptrs.ll
    M llvm/test/Transforms/DeadStoreElimination/OverwriteStoreBegin.ll
    A llvm/test/Transforms/DeadStoreElimination/opaque-ptr.ll
    M llvm/test/Transforms/InstCombine/force-opaque-ptr.ll
    M llvm/test/Transforms/InstCombine/opaque-ptr.ll
    M llvm/test/Transforms/LoadStoreVectorizer/X86/opaque-ptr.ll
    M llvm/test/Transforms/LoopStrengthReduce/opaque-ptr.ll
    M llvm/test/Transforms/LoopVectorize/opaque-ptr.ll
    M llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
    M llvm/test/Transforms/MemCpyOpt/no-libcalls.ll
    A llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll
    M llvm/test/Transforms/SLPVectorizer/X86/opaque-ptr.ll
    M llvm/test/Transforms/SROA/basictest-opaque-ptrs.ll
    A llvm/test/Transforms/SimplifyCFG/speculate-store-opaque-pointer.ll
    M llvm/test/Transforms/SimplifyCFG/speculate-store.ll
    M llvm/test/Verifier/force-opaque-ptr.ll
    M llvm/test/Verifier/musttail-invalid.ll
    M llvm/test/Verifier/opaque-ptr-invalid.ll
    M llvm/test/Verifier/opaque-ptr.ll
    M llvm/unittests/IR/TypesTest.cpp

  Log Message:
  -----------
  [OpaquePtr] Forbid mixing typed and opaque pointers

Currently, opaque pointers are supported in two forms: The
-force-opaque-pointers mode, where all pointers are opaque and
typed pointers do not exist. And as a simple ptr type that can
coexist with typed pointers.

This patch removes support for the mixed mode. You either get
typed pointers, or you get opaque pointers, but not both. In the
(current) default mode, using ptr is forbidden. In -opaque-pointers
mode, all pointers are opaque.

The motivation here is that the mixed mode introduces additional
issues that don't exist in fully opaque mode. D105155 is an example
of a design problem. Looking at D109259, it would probably need
additional work to support mixed mode (e.g. to generate GEPs for
typed base but opaque result). Mixed mode will also end up
inserting many casts between i8* and ptr, which would require
significant additional work to consistently avoid.

I don't think the mixed mode is particularly valuable, as it
doesn't align with our end goal. The only thing I've found it to
be moderately useful for is adding some opaque pointer tests in
between typed pointer tests, but I think we can live without that.

Differential Revision: https://reviews.llvm.org/D109290




More information about the All-commits mailing list