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 'ptr addrspace(40)' but expected 'ptr 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 'ptr addrspace(40)' but expected 'ptr'
13 define void @f_named(i16 %n, ptr addrspace(40) %f) addrspace(40) {
15 %f.addr = alloca ptr addrspace(40), align 1
16 store ptr addrspace(40) %f, ptr %f.addr
17 %fnptr = load ptr addrspace(40), ptr %f.addr
18 call void %fnptr(i16 8)
22 define void @f_numbered(i16 %n, ptr addrspace(40) %f) addrspace(40){
24 %f.addr = alloca ptr addrspace(40), align 1
25 store ptr addrspace(40) %f, ptr %f.addr
26 %0 = load ptr addrspace(40), ptr %f.addr