llvm-project/clang/test/CodeGenCXX/aix-alignment.cpp
Juneyoung Lee f193bcc701 Revert D105169 due to the two-stage failure in ASAN
This reverts the following commits:
37ca7a795b277c20c02a218bf44052278c03344b
9aa6c72b92b6c89cc6d23b693257df9af7de2d15
705387c5074bcca36d626882462ebbc2bcc3bed4
8ca4b3ef19fe82d7ad6a6e1515317dcc01b41515
80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a
2021-10-18 23:52:46 +09:00

41 lines
1.4 KiB
C++

// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -triple powerpc-unknown-aix \
// RUN: -emit-llvm -o - -x c++ %s | \
// RUN: FileCheck %s --check-prefixes=AIX,AIX32
// RUN: %clang_cc1 -triple powerpc64-unknown-aix \
// RUN: -emit-llvm -o - %s -x c++| \
// RUN: FileCheck %s --check-prefixes=AIX,AIX64
struct B {
double d;
~B() {}
};
// AIX32: %call = call noalias nonnull i8* @_Znam(i32 8)
// AIX64: %call = call noalias nonnull i8* @_Znam(i64 8)
B *allocBp() { return new B[0]; }
// AIX-LABEL: delete.notnull:
// AIX32: %0 = bitcast %struct.B* %call to i8*
// AIX32: %1 = getelementptr inbounds i8, i8* %0, i32 -8
// AIX32: %2 = getelementptr inbounds i8, i8* %1, i32 4
// AIX32: %3 = bitcast i8* %2 to i32*
// AIX64: %0 = bitcast %struct.B* %call to i8*
// AIX64: %1 = getelementptr inbounds i8, i8* %0, i64 -8
// AIX64: %2 = bitcast i8* %1 to i64*
void bar() { delete[] allocBp(); }
typedef struct D {
double d;
int i;
~D(){};
} D;
// AIX: define void @_Z3foo1D(%struct.D* noalias sret(%struct.D) align 4 %agg.result, %struct.D* %x)
// AIX: %1 = bitcast %struct.D* %agg.result to i8*
// AIX: %2 = bitcast %struct.D* %x to i8*
// AIX32 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %2, i32 16, i1 false)
// AIX64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 %2, i64 16, i1 false)
D foo(D x) { return x; }