1; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s -check-prefixes CHECK,PROG-AS0 2; RUN: llvm-as -data-layout "P200" %s -o - | llvm-dis | FileCheck %s -check-prefixes CHECK,PROG-AS200 3; RUN: not --crash llvm-as -data-layout "P123456789" %s -o /dev/null 2>&1 | FileCheck %s -check-prefix BAD-DATALAYOUT 4; BAD-DATALAYOUT: LLVM ERROR: Invalid address space, must be a 24-bit integer 5 6; PROG-AS0-NOT: target datalayout 7; PROG-AS200: target datalayout = "P200" 8 9; Check that a function declaration without an address space (i.e. AS0) does not 10; have the addrspace() attribute printed if it is address space zero and it is 11; equal to the program address space. 12 13; PROG-AS0: define void @no_as() { 14; PROG-AS200: define void @no_as() addrspace(200) { 15define void @no_as() { 16 ret void 17} 18 19; A function with an explicit addrspace should only have the addrspace printed 20; if it is non-zero or if the module has a nonzero datalayout 21; PROG-AS0: define void @explit_as0() { 22; PROG-AS200: define void @explit_as0() addrspace(0) { 23define void @explit_as0() addrspace(0) { 24 ret void 25} 26 27; CHECK: define void @explit_as200() addrspace(200) { 28define void @explit_as200() addrspace(200) { 29 ret void 30} 31 32; CHECK: define void @explicit_as3() addrspace(3) { 33define void @explicit_as3() addrspace(3) { 34 ret void 35} 36