1 ; Verify that we accept calls to variables in the program AS:
2 ; RUN: llvm-as -data-layout "P40" %s -o - | llvm-dis - | FileCheck %s
3 ; CHECK: target datalayout = "P40"
5 ; We should get a sensible error for a non-program address call:
6 ; RUN: not llvm-as -data-layout "P39" %s -o /dev/null 2>&1 | FileCheck %s -check-prefix ERR-AS39
7 ; ERR-AS39: error: '%fnptr' defined with type 'void (i16) addrspace(40)*' but expected 'void (i16) addrspace(39)*'
9 ; And also if we don't set a custom program address space:
10 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s -check-prefix ERR-AS0
11 ; ERR-AS0: error: '%fnptr' defined with type 'void (i16) addrspace(40)*' but expected 'void (i16)*'
13 define void @f_named(i16 %n, void (i16) addrspace(40)* %f) addrspace(40) {
15 %f.addr = alloca void (i16) addrspace(40)*, align 1
16 store void (i16) addrspace(40)* %f, void (i16) addrspace(40)** %f.addr
17 %fnptr = load void (i16) addrspace(40)*, void (i16) addrspace(40)** %f.addr
18 call void %fnptr(i16 8)
22 define void @f_numbered(i16 %n, void (i16) addrspace(40)* %f) addrspace(40){
24 %f.addr = alloca void (i16) addrspace(40)*, align 1
25 store void (i16) addrspace(40)* %f, void (i16) addrspace(40)** %f.addr
26 %0 = load void (i16) addrspace(40)*, void (i16) addrspace(40)** %f.addr