1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc-unknown-aix \
3 // RUN:     -emit-llvm -o - -x c++ %s | \
4 // RUN:   FileCheck %s --check-prefixes=AIX,AIX32
5 // RUN: %clang_cc1 -triple powerpc64-unknown-aix \
6 // RUN:     -emit-llvm -o - %s -x c++| \
7 // RUN:   FileCheck %s --check-prefixes=AIX,AIX64
8 
9 struct B {
10   double d;
~BB11   ~B() {}
12 };
13 
14 // AIX32: %call = call noalias nonnull i8* @_Znam(i32 8)
15 // AIX64: %call = call noalias nonnull i8* @_Znam(i64 8)
allocBp()16 B *allocBp() { return new B[0]; }
17 
18 // AIX-LABEL: delete.notnull:
19 // AIX32: %0 = bitcast %struct.B* %call to i8*
20 // AIX32: %1 = getelementptr inbounds i8, i8* %0, i32 -8
21 // AIX32: %2 = getelementptr inbounds i8, i8* %1, i32 4
22 // AIX32: %3 = bitcast i8* %2 to i32*
23 // AIX64: %0 = bitcast %struct.B* %call to i8*
24 // AIX64: %1 = getelementptr inbounds i8, i8* %0, i64 -8
25 // AIX64: %2 = bitcast i8* %1 to i64*
bar()26 void bar() { delete[] allocBp(); }
27 
28 typedef struct D {
29   double d;
30   int i;
31 
~DD32   ~D(){};
33 } D;
34 
35 // AIX: define void @_Z3foo1D(%struct.D* noalias sret(%struct.D) align 4 %agg.result, %struct.D* %x)
36 // AIX:   %1 = bitcast %struct.D* %agg.result to i8*
37 // AIX:   %2 = bitcast %struct.D* %x to i8*
38 // AIX32  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %2, i32 16, i1 false)
39 // AIX64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 %2, i64 16, i1 false)
foo(D x)40 D foo(D x) { return x; }
41