Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / address-space-ref.cpp
blob9f2dead9e82ae4cf97ca68e00bafee8bca9136d4
1 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,NULL-INVALID
2 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -fno-delete-null-pointer-checks -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,NULL-VALID
4 // For a reference to a complete type, output the dereferenceable attribute (in
5 // any address space).
7 typedef int a __attribute__((address_space(1)));
9 a & foo(a &x, a & y) {
10 return x;
13 // CHECK: define{{.*}} align 4 dereferenceable(4) ptr addrspace(1) @_Z3fooRU3AS1iS0_(ptr addrspace(1) noundef align 4 dereferenceable(4) %x, ptr addrspace(1) noundef align 4 dereferenceable(4) %y)
15 // For a reference to an incomplete type in an alternate address space, output
16 // neither dereferenceable nor nonnull.
18 class bc;
19 typedef bc b __attribute__((address_space(1)));
21 b & bar(b &x, b & y) {
22 return x;
25 // CHECK: define{{.*}} align 1 ptr addrspace(1) @_Z3barRU3AS12bcS1_(ptr addrspace(1) noundef align 1 %x, ptr addrspace(1) noundef align 1 %y)
27 // For a reference to an incomplete type in addrspace(0), output nonnull.
29 bc & bar2(bc &x, bc & y) {
30 return x;
33 // NULL-INVALID: define{{.*}} nonnull align 1 ptr @_Z4bar2R2bcS0_(ptr noundef nonnull align 1 %x, ptr noundef nonnull align 1 %y)
34 // NULL-VALID: define{{.*}} align 1 ptr @_Z4bar2R2bcS0_(ptr noundef align 1 %x, ptr noundef align 1 %y)