1; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s 2; RUN: llvm-as %s -data-layout=P42 -o - | llvm-dis - -o - | FileCheck %s -check-prefix PROGAS42 3 4; Check that variables in a nonzero program address space 42 can be used in a call instruction 5 6define i8 @test(i8(i32)* %fnptr0, i8(i32) addrspace(42)* %fnptr42) { 7 %explicit_as_0 = call addrspace(0) i8 %fnptr0(i32 0) 8 %explicit_as_42 = call addrspace(42) i8 %fnptr42(i32 0) 9 ; Calling %fnptr42 without an explicit addrspace() in the call instruction is only okay if the program AS is 42 10 %call_no_as = call i8 %fnptr42(i32 0) 11 ; CHECK: call-nonzero-program-addrspace.ll:[[@LINE-1]]:25: error: '%fnptr42' defined with type 'i8 (i32) addrspace(42)*' but expected 'i8 (i32)*' 12 ret i8 0 13} 14 15; PROGAS42: target datalayout = "P42" 16; PROGAS42: define i8 @test(i8 (i32)* %fnptr0, i8 (i32) addrspace(42)* %fnptr42) addrspace(42) { 17; Print addrspace(0) since the program address space is non-zero: 18; PROGAS42-NEXT: %explicit_as_0 = call addrspace(0) i8 %fnptr0(i32 0) 19; Also print addrspace(42) since we always print non-zero addrspace: 20; PROGAS42-NEXT: %explicit_as_42 = call addrspace(42) i8 %fnptr42(i32 0) 21; PROGAS42-NEXT: %call_no_as = call addrspace(42) i8 %fnptr42(i32 0) 22; PROGAS42-NEXT: ret i8 0 23; PROGAS42-NEXT: } 24