llvm-project/llvm/test/Linker/wrong-addrspace-gv-declaration.ll
Nikita Popov 41d5033eb1 [IR] Enable opaque pointers by default
This enabled opaque pointers by default in LLVM. The effect of this
is twofold:

* If IR that contains *neither* explicit ptr nor %T* types is passed
  to tools, we will now use opaque pointer mode, unless
  -opaque-pointers=0 has been explicitly passed.
* Users of LLVM as a library will now default to opaque pointers.
  It is possible to opt-out by calling setOpaquePointers(false) on
  LLVMContext.

A cmake option to toggle this default will not be provided. Frontends
or other tools that want to (temporarily) keep using typed pointers
should disable opaque pointers via LLVMContext.

Differential Revision: https://reviews.llvm.org/D126689
2022-06-02 09:40:56 +02:00

18 lines
764 B
LLVM

; RUN: llvm-link %s %p/Inputs/wrong-addrspace-gv-declaration.ll -S | FileCheck %s
; RUN: llvm-link %p/Inputs/wrong-addrspace-gv-declaration.ll %s -S | FileCheck %s
; The address space is declared incorrectly here, so an addrspacecast
; is needed to link.
@is_really_as1_gv = external global i32
@is_really_as1_gv_other_type = external global i32
; CHECK-LABEL: @foo(
; CHECK: %load0 = load volatile i32, ptr addrspacecast (ptr addrspace(1) @is_really_as1_gv to ptr), align 4
; CHECK: %load1 = load volatile i32, ptr addrspacecast (ptr addrspace(1) @is_really_as1_gv_other_type to ptr), align 4
define void @foo() {
%load0 = load volatile i32, ptr @is_really_as1_gv, align 4
%load1 = load volatile i32, ptr @is_really_as1_gv_other_type, align 4
ret void
}