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 noundef nonnull ptr @_Znam(i32 noundef 8)
15 // AIX64: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 8)
allocBp()16 B *allocBp() { return new B[0]; }
17
18 // AIX-LABEL: delete.notnull:
19 // AIX32: %0 = getelementptr inbounds i8, ptr %call, i32 -8
20 // AIX32: [[PTR:%.+]] = getelementptr inbounds i8, ptr %0, i32 4
21 // AIX64: [[PTR:%.+]] = getelementptr inbounds i8, ptr %call, i64 -8
22 // AIX: %{{.+}} = load i{{[0-9]+}}, ptr [[PTR]]
bar()23 void bar() { delete[] allocBp(); }
24
25 typedef struct D {
26 double d;
27 int i;
28
~DD29 ~D(){};
30 } D;
31
32 // AIX: define void @_Z3foo1D(ptr dead_on_unwind noalias writable sret(%struct.D) align 4 %agg.result, ptr noundef %x)
33 // AIX32 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %agg.result, ptr align 4 %x, i32 16, i1 false)
34 // AIX64: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.result, ptr align 4 %x, i64 16, i1 false)
foo(D x)35 D foo(D x) { return x; }
36