diff --git a/clang/test/CodeGenCXX/2011-12-19-init-list-ctor.cpp b/clang/test/CodeGenCXX/2011-12-19-init-list-ctor.cpp --- a/clang/test/CodeGenCXX/2011-12-19-init-list-ctor.cpp +++ b/clang/test/CodeGenCXX/2011-12-19-init-list-ctor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple x86_64-linux-gnu | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-linux-gnu | FileCheck %s struct A { A(const char *); @@ -18,9 +18,9 @@ { 2, "goodbye" } }; -// CHECK: store i32 0, i32* getelementptr inbounds ([3 x %struct.S], [3 x %struct.S]* @arr, i64 0, i64 0, i32 0) -// CHECK: call void @_ZN1AC1EPKc(%struct.A* {{[^,]*}} getelementptr inbounds ([3 x %struct.S], [3 x %struct.S]* @arr, i64 0, i64 0, i32 1), i8* noundef getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)) -// CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.S], [3 x %struct.S]* @arr, i64 0, i64 1, i32 0) -// CHECK: call void @_ZN1AC1EPKc(%struct.A* {{[^,]*}} getelementptr inbounds ([3 x %struct.S], [3 x %struct.S]* @arr, i64 0, i64 1, i32 1), i8* noundef getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)) -// CHECK: store i32 2, i32* getelementptr inbounds ([3 x %struct.S], [3 x %struct.S]* @arr, i64 0, i64 2, i32 0) -// CHECK: call void @_ZN1AC1EPKc(%struct.A* {{[^,]*}} getelementptr inbounds ([3 x %struct.S], [3 x %struct.S]* @arr, i64 0, i64 2, i32 1), i8* noundef getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)) +// CHECK: store i32 0, ptr @arr +// CHECK: call void @_ZN1AC1EPKc(ptr {{[^,]*}} getelementptr inbounds (%struct.S, ptr @arr, i32 0, i32 1), ptr noundef @.str) +// CHECK: store i32 1, ptr getelementptr inbounds (%struct.S, ptr @arr, i64 1) +// CHECK: call void @_ZN1AC1EPKc(ptr {{[^,]*}} getelementptr inbounds (%struct.S, ptr @arr, i64 1, i32 1), ptr noundef @.str.1) +// CHECK: store i32 2, ptr getelementptr inbounds (%struct.S, ptr @arr, i64 2) +// CHECK: call void @_ZN1AC1EPKc(ptr {{[^,]*}} getelementptr inbounds (%struct.S, ptr @arr, i64 2, i32 1), ptr noundef @.str.2) diff --git a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp --- a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp +++ b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s template struct my_vector_base; @@ -46,8 +46,9 @@ char1 f1{1}; char1 f2{1}; -// CHECK: %[[a:[^ ]+]] = addrspacecast i16 addrspace(5)* %{{[^ ]+}} to i16* -// CHECK: %[[a:[^ ]+]] = addrspacecast %{{[^ ]+}} addrspace(5)* %{{[^ ]+}} to %{{[^ ]+}} +// CHECK: [[TMP:%.+]] = alloca i16 +// CHECK: [[COERCE:%.+]] = addrspacecast ptr addrspace(5) [[TMP]] to ptr +// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %{{.+}}, ptr align 2 [[COERCE]], i64 1, i1 false) char1 f3 = f1 + f2; } diff --git a/clang/test/CodeGenCXX/address-space-cast.cpp b/clang/test/CodeGenCXX/address-space-cast.cpp --- a/clang/test/CodeGenCXX/address-space-cast.cpp +++ b/clang/test/CodeGenCXX/address-space-cast.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s #define __private__ __attribute__((address_space(5))) @@ -16,60 +16,61 @@ __private__ Base *b = (__private__ Base *)p; } +// CHECK-LABEL: test_cast void test_cast(char *gen_char_ptr, void *gen_void_ptr, int *gen_int_ptr) { - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: store i8 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] __private__ char *priv_char_ptr = (__private__ char *)gen_char_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: store i8 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] priv_char_ptr = (__private__ char *)gen_void_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: store i8 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] priv_char_ptr = (__private__ char *)gen_int_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: store i8 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] __private__ void *priv_void_ptr = (__private__ void *)gen_char_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: store i8 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] priv_void_ptr = (__private__ void *)gen_void_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: store i8 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] priv_void_ptr = (__private__ void *)gen_int_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i32 addrspace(5)* - // CHECK-NEXT: store i32 addrspace(5)* %[[cast]] + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: store ptr addrspace(5) %[[cast]] __private__ int *priv_int_ptr = (__private__ int *)gen_void_ptr; - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(ptr addrspace(5) noundef %[[cast]]) func_pchar((__private__ char *)gen_char_ptr); - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(ptr addrspace(5) noundef %[[cast]]) func_pchar((__private__ char *)gen_void_ptr); - // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(ptr addrspace(5) noundef %[[cast]]) func_pchar((__private__ char *)gen_int_ptr); - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(ptr addrspace(5) noundef %[[cast]]) func_pvoid((__private__ void *)gen_char_ptr); - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(ptr addrspace(5) noundef %[[cast]]) func_pvoid((__private__ void *)gen_void_ptr); - // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)* - // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(ptr addrspace(5) noundef %[[cast]]) func_pvoid((__private__ void *)gen_int_ptr); - // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i32 addrspace(5)* - // CHECK-NEXT: call void @_Z9func_pintPU3AS5i(i32 addrspace(5)* noundef %[[cast]]) + // CHECK: %[[cast:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(5) + // CHECK-NEXT: call void @_Z9func_pintPU3AS5i(ptr addrspace(5) noundef %[[cast]]) func_pint((__private__ int *)gen_void_ptr); } diff --git a/clang/test/CodeGenCXX/aix-alignment.cpp b/clang/test/CodeGenCXX/aix-alignment.cpp --- a/clang/test/CodeGenCXX/aix-alignment.cpp +++ b/clang/test/CodeGenCXX/aix-alignment.cpp @@ -1,8 +1,8 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix \ +// RUN: %clang_cc1 -triple powerpc-unknown-aix \ // RUN: -emit-llvm -o - -x c++ %s | \ // RUN: FileCheck %s --check-prefixes=AIX,AIX32 -// RUN: %clang_cc1 -no-opaque-pointers -triple powerpc64-unknown-aix \ +// RUN: %clang_cc1 -triple powerpc64-unknown-aix \ // RUN: -emit-llvm -o - %s -x c++| \ // RUN: FileCheck %s --check-prefixes=AIX,AIX64 @@ -11,18 +11,15 @@ ~B() {} }; -// AIX32: %call = call noalias noundef nonnull i8* @_Znam(i32 noundef 8) -// AIX64: %call = call noalias noundef nonnull i8* @_Znam(i64 noundef 8) +// AIX32: %call = call noalias noundef nonnull ptr @_Znam(i32 noundef 8) +// AIX64: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 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* +// AIX32: %0 = getelementptr inbounds i8, ptr %call, i32 -8 +// AIX32: [[PTR:%.+]] = getelementptr inbounds i8, ptr %0, i32 4 +// AIX64: [[PTR:%.+]] = getelementptr inbounds i8, ptr %call, i64 -8 +// AIX: %{{.+}} = load i{{[0-9]+}}, ptr [[PTR]] void bar() { delete[] allocBp(); } typedef struct D { @@ -32,9 +29,7 @@ ~D(){}; } D; -// AIX: define void @_Z3foo1D(%struct.D* noalias sret(%struct.D) align 4 %agg.result, %struct.D* noundef %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) +// AIX: define void @_Z3foo1D(ptr noalias sret(%struct.D) align 4 %agg.result, ptr noundef %x) +// AIX32 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %agg.result, ptr align 4 %x, i32 16, i1 false) +// AIX64: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.result, ptr align 4 %x, i64 16, i1 false) D foo(D x) { return x; } diff --git a/clang/test/CodeGenCXX/alignment.cpp b/clang/test/CodeGenCXX/alignment.cpp --- a/clang/test/CodeGenCXX/alignment.cpp +++ b/clang/test/CodeGenCXX/alignment.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCOMPAT -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -fclang-abi-compat=6.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=x86_64-scei-ps4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=x86_64-sie-ps5 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCOMPAT +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -fclang-abi-compat=6.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-scei-ps4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-sie-ps5 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT extern int int_source(); extern void int_sink(int x); @@ -26,19 +26,17 @@ // CHECK-LABEL: @_ZN5test01aERNS_1BE void a(B &b) { // CHECK: [[CALL:%.*]] = call noundef i32 @_Z10int_sourcev() - // CHECK: [[B_P:%.*]] = load [[B:%.*]]*, [[B]]** - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* + // CHECK: [[B_P:%.*]] = load ptr, ptr // CHECK: [[TRUNC:%.*]] = trunc i32 [[CALL]] to i8 - // CHECK: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK: [[OLD_VALUE:%.*]] = load i8, ptr [[B_P]], align 4 // CHECK: [[T0:%.*]] = and i8 [[TRUNC]], 3 // CHECK: [[T1:%.*]] = and i8 [[OLD_VALUE]], -4 // CHECK: [[T2:%.*]] = or i8 [[T1]], [[T0]] - // CHECK: store i8 [[T2]], i8* [[FIELD_P]], align 4 + // CHECK: store i8 [[T2]], ptr [[B_P]], align 4 b.onebit = int_source(); - // CHECK: [[B_P:%.*]] = load [[B]]*, [[B]]** - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* - // CHECK: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK: [[B_P:%.*]] = load ptr, ptr + // CHECK: [[VALUE:%.*]] = load i8, ptr [[B_P]], align 4 // CHECK: [[T0:%.*]] = shl i8 [[VALUE]], 6 // CHECK: [[T1:%.*]] = ashr i8 [[T0]], 6 // CHECK: [[T2:%.*]] = sext i8 [[T1]] to i32 @@ -51,28 +49,22 @@ // CHECK-LABEL: @_ZN5test01bERNS_1CE void b(C &c) { // CHECK: [[CALL:%.*]] = call noundef i32 @_Z10int_sourcev() - // CHECK: [[C_P:%.*]] = load [[C:%.*]]*, [[C]]** - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* + // CHECK: [[C_P:%.*]] = load ptr, ptr + // CHECK: [[FIELD_P:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 // CHECK: [[TRUNC:%.*]] = trunc i32 [[CALL]] to i8 - // CHECK-V6COMPAT: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK-V6COMPAT: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 4 // CHECK: [[T0:%.*]] = and i8 [[TRUNC]], 3 // CHECK: [[T1:%.*]] = and i8 [[OLD_VALUE]], -4 // CHECK: [[T2:%.*]] = or i8 [[T1]], [[T0]] - // CHECK-V6COMPAT: store i8 [[T2]], i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: store i8 [[T2]], i8* [[FIELD_P]], align 4 + // CHECK-V6COMPAT: store i8 [[T2]], ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: store i8 [[T2]], ptr [[FIELD_P]], align 4 c.onebit = int_source(); - // CHECK: [[C_P:%.*]] = load [[C]]*, [[C]]** - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* - // CHECK-V6COMPAT: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK: [[C_P:%.*]] = load ptr, ptr + // CHECK: [[FIELD_P:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 + // CHECK-V6COMPAT: [[VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: [[VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 4 // CHECK: [[T0:%.*]] = shl i8 [[VALUE]], 6 // CHECK: [[T1:%.*]] = ashr i8 [[T0]], 6 // CHECK: [[T2:%.*]] = sext i8 [[T1]] to i32 @@ -83,28 +75,22 @@ // CHECK-LABEL: @_ZN5test01cEPNS_1CE void c(C *c) { // CHECK: [[CALL:%.*]] = call noundef i32 @_Z10int_sourcev() - // CHECK: [[C_P:%.*]] = load [[C]]*, [[C]]** - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* + // CHECK: [[C_P:%.*]] = load ptr, ptr + // CHECK: [[FIELD_P:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 // CHECK: [[TRUNC:%.*]] = trunc i32 [[CALL]] to i8 - // CHECK-V6COMPAT: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK-V6COMPAT: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 4 // CHECK: [[T0:%.*]] = and i8 [[TRUNC]], 3 // CHECK: [[T1:%.*]] = and i8 [[OLD_VALUE]], -4 // CHECK: [[T2:%.*]] = or i8 [[T1]], [[T0]] - // CHECK-V6COMPAT: store i8 [[T2]], i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: store i8 [[T2]], i8* [[FIELD_P]], align 4 + // CHECK-V6COMPAT: store i8 [[T2]], ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: store i8 [[T2]], ptr [[FIELD_P]], align 4 c->onebit = int_source(); - // CHECK: [[C_P:%.*]] = load [[C:%.*]]*, [[C]]** - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B:%.*]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* - // CHECK-V6COMPAT: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK: [[C_P:%.*]] = load ptr, ptr + // CHECK: [[P:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 + // CHECK-V6COMPAT: [[VALUE:%.*]] = load i8, ptr [[P]], align 2 + // CHECK-NOCOMPAT: [[VALUE:%.*]] = load i8, ptr [[P]], align 4 // CHECK: [[T0:%.*]] = shl i8 [[VALUE]], 6 // CHECK: [[T1:%.*]] = ashr i8 [[T0]], 6 // CHECK: [[T2:%.*]] = sext i8 [[T1]] to i32 @@ -121,26 +107,20 @@ C c; // CHECK: [[CALL:%.*]] = call noundef i32 @_Z10int_sourcev() - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* + // CHECK: [[FIELD_P:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 // CHECK: [[TRUNC:%.*]] = trunc i32 [[CALL]] to i8 - // CHECK-V6COMPAT: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK-V6COMPAT: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 4 // CHECK: [[T0:%.*]] = and i8 [[TRUNC]], 3 // CHECK: [[T1:%.*]] = and i8 [[OLD_VALUE]], -4 // CHECK: [[T2:%.*]] = or i8 [[T1]], [[T0]] - // CHECK-V6COMPAT: store i8 [[T2]], i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: store i8 [[T2]], i8* [[FIELD_P]], align 4 + // CHECK-V6COMPAT: store i8 [[T2]], ptr [[FIELD_P]], align 2 + // CHECK-NOCOMPAT: store i8 [[T2]], ptr [[FIELD_P]], align 4 c.onebit = int_source(); - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B:%.*]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* - // CHECK-V6COMPAT: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 2 - // CHECK-NOCOMPAT: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 4 + // CHECK: [[T1:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 + // CHECK-V6COMPAT: [[VALUE:%.*]] = load i8, ptr [[T1]], align 2 + // CHECK-NOCOMPAT: [[VALUE:%.*]] = load i8, ptr [[T1]], align 4 // CHECK: [[T0:%.*]] = shl i8 [[VALUE]], 6 // CHECK: [[T1:%.*]] = ashr i8 [[T0]], 6 // CHECK: [[T2:%.*]] = sext i8 [[T1]] to i32 @@ -156,23 +136,17 @@ __attribute__((aligned(16))) C c; // CHECK: [[CALL:%.*]] = call noundef i32 @_Z10int_sourcev() - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* + // CHECK: [[FIELD_P:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 // CHECK: [[TRUNC:%.*]] = trunc i32 [[CALL]] to i8 - // CHECK: [[OLD_VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 8 + // CHECK: [[OLD_VALUE:%.*]] = load i8, ptr [[FIELD_P]], align 8 // CHECK: [[T0:%.*]] = and i8 [[TRUNC]], 3 // CHECK: [[T1:%.*]] = and i8 [[OLD_VALUE]], -4 // CHECK: [[T2:%.*]] = or i8 [[T1]], [[T0]] - // CHECK: store i8 [[T2]], i8* [[FIELD_P]], align 8 + // CHECK: store i8 [[T2]], ptr [[FIELD_P]], align 8 c.onebit = int_source(); - // CHECK: [[T0:%.*]] = bitcast [[C]]* [[C_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 8 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B:%.*]]* - // CHECK: [[FIELD_P:%.*]] = bitcast [[B]]* [[B_P]] to i8* - // CHECK: [[VALUE:%.*]] = load i8, i8* [[FIELD_P]], align 8 + // CHECK: [[T1:%.*]] = getelementptr inbounds i8, ptr [[C_P]], i64 8 + // CHECK: [[VALUE:%.*]] = load i8, ptr [[T1]], align 8 // CHECK: [[T0:%.*]] = shl i8 [[VALUE]], 6 // CHECK: [[T1:%.*]] = ashr i8 [[T0]], 6 // CHECK: [[T2:%.*]] = sext i8 [[T1]] to i32 @@ -213,63 +187,49 @@ // CHECK-LABEL: @_ZN5test11aERNS_1AE void a(A &a) { // CHECK: [[RESULT:%.*]] = alloca [[ARRAY:%.*]], align 64 - // CHECK: [[A_P:%.*]] = load [[A:%.*]]*, [[A]]** - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[A]], [[A]]* [[A_P]], i32 0, i32 0 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 16 [[T1]], i64 16, i1 false) + // CHECK: [[A_P:%.*]] = load ptr, ptr + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[A:%.*]], ptr [[A_P]], i32 0, i32 0 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 16 [[ARRAY_P]], i64 16, i1 false) AlignedArray result = a.aArray; } // CHECK-LABEL: @_ZN5test11bERNS_1BE void b(B &b) { // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[B_P:%.*]] = load [[B:%.*]]*, [[B]]** - // CHECK: [[VPTR_P:%.*]] = bitcast [[B]]* [[B_P]] to i8** - // CHECK: [[VPTR:%.*]] = load i8*, i8** [[VPTR_P]], align 8 - // CHECK: [[T0:%.*]] = getelementptr i8, i8* [[VPTR]], i64 -24 - // CHECK: [[OFFSET_P:%.*]] = bitcast i8* [[T0]] to i64* - // CHECK: [[OFFSET:%.*]] = load i64, i64* [[OFFSET_P]], align 8 - // CHECK: [[T0:%.*]] = bitcast [[B]]* [[B_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 [[OFFSET]] - // CHECK: [[A_P:%.*]] = bitcast i8* [[T1]] to [[A]]* - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[A]], [[A]]* [[A_P]], i32 0, i32 0 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 16 [[T1]], i64 16, i1 false) + // CHECK: [[B_P:%.*]] = load ptr, ptr + // CHECK: [[VPTR:%.*]] = load ptr, ptr [[B_P]], align 8 + // CHECK: [[T0:%.*]] = getelementptr i8, ptr [[VPTR]], i64 -24 + // CHECK: [[OFFSET:%.*]] = load i64, ptr [[T0]], align 8 + // CHECK: [[T1:%.*]] = getelementptr inbounds i8, ptr [[B_P]], i64 [[OFFSET]] + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[A]], ptr [[T1]], i32 0, i32 0 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 16 [[ARRAY_P]], i64 16, i1 false) AlignedArray result = b.aArray; } // CHECK-LABEL: @_ZN5test11cERNS_1BE void c(B &b) { // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[B_P:%.*]] = load [[B]]*, [[B]]** - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B]], [[B]]* [[B_P]], i32 0, i32 2 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 8 [[T1]], i64 16, i1 false) + // CHECK: [[B_P:%.*]] = load ptr, ptr + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B:%.*]], ptr [[B_P]], i32 0, i32 2 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 8 [[ARRAY_P]], i64 16, i1 false) AlignedArray result = b.bArray; } // CHECK-LABEL: @_ZN5test11dEPNS_1BE void d(B *b) { // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[B_P:%.*]] = load [[B]]*, [[B]]** - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B]], [[B]]* [[B_P]], i32 0, i32 2 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 8 [[T1]], i64 16, i1 false) + // CHECK: [[B_P:%.*]] = load ptr, ptr + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B:%.*]], ptr [[B_P]], i32 0, i32 2 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 8 [[ARRAY_P]], i64 16, i1 false) AlignedArray result = b->bArray; } // CHECK-LABEL: @_ZN5test11eEv void e() { - // CHECK: [[B_P:%.*]] = alloca [[B]], align 16 + // CHECK: [[B_P:%.*]] = alloca [[B:%.*]], align 16 // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B]], [[B]]* [[B_P]], i32 0, i32 2 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 16 [[T1]], i64 16, i1 false) + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B:%.*]], ptr [[B_P]], i32 0, i32 2 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 16 [[ARRAY_P]], i64 16, i1 false) B b; AlignedArray result = b.bArray; } @@ -279,18 +239,12 @@ // TODO: we should devirtualize this derived-to-base conversion. // CHECK: [[D_P:%.*]] = alloca [[D:%.*]], align 16 // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[VPTR_P:%.*]] = bitcast [[D]]* [[D_P]] to i8** - // CHECK: [[VPTR:%.*]] = load i8*, i8** [[VPTR_P]], align 16 - // CHECK: [[T0:%.*]] = getelementptr i8, i8* [[VPTR]], i64 -24 - // CHECK: [[OFFSET_P:%.*]] = bitcast i8* [[T0]] to i64* - // CHECK: [[OFFSET:%.*]] = load i64, i64* [[OFFSET_P]], align 8 - // CHECK: [[T0:%.*]] = bitcast [[D]]* [[D_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 [[OFFSET]] - // CHECK: [[A_P:%.*]] = bitcast i8* [[T1]] to [[A]]* - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[A]], [[A]]* [[A_P]], i32 0, i32 0 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 16 [[T1]], i64 16, i1 false) + // CHECK: [[VPTR:%.*]] = load ptr, ptr [[D_P]], align 16 + // CHECK: [[T0:%.*]] = getelementptr i8, ptr [[VPTR]], i64 -24 + // CHECK: [[OFFSET:%.*]] = load i64, ptr [[T0]], align 8 + // CHECK: [[T1:%.*]] = getelementptr inbounds i8, ptr [[D_P]], i64 [[OFFSET]] + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[A]], ptr [[T1]], i32 0, i32 0 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 16 [[ARRAY_P]], i64 16, i1 false) D d; AlignedArray result = d.aArray; } @@ -299,13 +253,9 @@ void g() { // CHECK: [[D_P:%.*]] = alloca [[D]], align 16 // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[T0:%.*]] = bitcast [[D]]* [[D_P]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 24 - // CHECK: [[B_P:%.*]] = bitcast i8* [[T1]] to [[B:%.*]]* - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B]], [[B]]* [[B_P]], i32 0, i32 2 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 8 [[T1]], i64 16, i1 false) + // CHECK: [[T1:%.*]] = getelementptr inbounds i8, ptr [[D_P]], i64 24 + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B:%.*]], ptr [[T1]], i32 0, i32 2 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 8 [[ARRAY_P]], i64 16, i1 false) D d; AlignedArray result = d.bArray; } @@ -313,16 +263,14 @@ // CHECK-LABEL: @_ZN5test11hEPA_NS_1BE void h(B (*b)[]) { // CHECK: [[RESULT:%.*]] = alloca [[ARRAY]], align 64 - // CHECK: [[B_P:%.*]] = load [0 x [[B]]]*, [0 x [[B]]]** - // CHECK: [[ELEMENT_P:%.*]] = getelementptr inbounds [0 x [[B]]], [0 x [[B]]]* [[B_P]], i64 0 - // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B]], [[B]]* [[ELEMENT_P]], i32 0, i32 2 - // CHECK: [[T0:%.*]] = bitcast [[ARRAY]]* [[RESULT]] to i8* - // CHECK: [[T1:%.*]] = bitcast [[ARRAY]]* [[ARRAY_P]] to i8* - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 64 [[T0]], i8* align 16 [[T1]], i64 16, i1 false) + // CHECK: [[B_P:%.*]] = load ptr, ptr + // CHECK: [[ELEMENT_P:%.*]] = getelementptr inbounds [0 x [[B]]], ptr [[B_P]], i64 0 + // CHECK: [[ARRAY_P:%.*]] = getelementptr inbounds [[B]], ptr [[ELEMENT_P]], i32 0, i32 2 + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 64 [[RESULT]], ptr align 16 [[ARRAY_P]], i64 16, i1 false) AlignedArray result = (*b)->bArray; } } // CHECK-LABEL: @_Z22incomplete_array_derefPA_i -// CHECK: load i32, i32* {{%.*}}, align 4 +// CHECK: load i32, ptr {{%.*}}, align 4 int incomplete_array_deref(int (*p)[]) { return (*p)[2]; } diff --git a/clang/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/clang/test/CodeGenCXX/anonymous-union-member-initializer.cpp --- a/clang/test/CodeGenCXX/anonymous-union-member-initializer.cpp +++ b/clang/test/CodeGenCXX/anonymous-union-member-initializer.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s // rdar://8818236 namespace rdar8818236 { @@ -35,14 +35,14 @@ void f(X x, X z) { X x1; - // CHECK: store i64 1, i64 + // CHECK: store i64 1, ptr x1.l = 1; - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64 + // CHECK: call void @llvm.memcpy.p0.p0.i64 X x2(x1); X x3; - // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64 + // CHECK: call void @llvm.memcpy.p0.p0.i64 x3 = x1; // CHECK: ret void @@ -80,36 +80,36 @@ }; // CHECK-LABEL: define{{.*}} void @_ZN7PR105121AC2Ev - // CHECK: [[THISADDR:%[a-zA-Z0-9.]+]] = alloca [[A:%"struct[A-Za-z0-9:.]+"]] - // CHECK-NEXT: store [[A]]* [[THIS:%[a-zA-Z0-9.]+]], [[A]]** [[THISADDR]] - // CHECK-NEXT: [[THIS1:%[a-zA-Z0-9.]+]] = load [[A]]*, [[A]]** [[THISADDR]] + // CHECK: [[THISADDR:%[a-zA-Z0-9.]+]] = alloca ptr + // CHECK-NEXT: store ptr [[THIS:%[a-zA-Z0-9.]+]], ptr [[THISADDR]] + // CHECK-NEXT: [[THIS1:%[a-zA-Z0-9.]+]] = load ptr, ptr [[THISADDR]] // CHECK-NEXT: ret void A::A() {} // CHECK-LABEL: define{{.*}} void @_ZN7PR105121AC2Ei - // CHECK: [[THISADDR:%[a-zA-Z0-9.]+]] = alloca [[A:%"struct[A-Za-z0-9:.]+"]] + // CHECK: [[THISADDR:%[a-zA-Z0-9.]+]] = alloca ptr // CHECK-NEXT: [[XADDR:%[a-zA-Z0-9.]+]] = alloca i32 - // CHECK-NEXT: store [[A]]* [[THIS:%[a-zA-Z0-9.]+]], [[A]]** [[THISADDR]] - // CHECK-NEXT: store i32 [[X:%[a-zA-Z0-9.]+]], i32* [[XADDR]] - // CHECK-NEXT: [[THIS1:%[a-zA-Z0-9.]+]] = load [[A]]*, [[A]]** [[THISADDR]] + // CHECK-NEXT: store ptr [[THIS:%[a-zA-Z0-9.]+]], ptr [[THISADDR]] + // CHECK-NEXT: store i32 [[X:%[a-zA-Z0-9.]+]], ptr [[XADDR]] + // CHECK-NEXT: [[THIS1:%[a-zA-Z0-9.]+]] = load ptr, ptr [[THISADDR]] // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} - // CHECK-NEXT: [[TMP:%[a-zA-Z0-9.]+]] = load i32, i32* [[XADDR]] + // CHECK-NEXT: [[TMP:%[a-zA-Z0-9.]+]] = load i32, ptr [[XADDR]] // CHECK-NEXT: store i32 [[TMP]] // CHECK-NEXT: ret void A::A(int x) : x(x) { } // CHECK-LABEL: define{{.*}} void @_ZN7PR105121AC2El - // CHECK: [[THISADDR:%[a-zA-Z0-9.]+]] = alloca [[A:%"struct[A-Za-z0-9:.]+"]] + // CHECK: [[THISADDR:%[a-zA-Z0-9.]+]] = alloca ptr // CHECK-NEXT: [[XADDR:%[a-zA-Z0-9.]+]] = alloca i64 - // CHECK-NEXT: store [[A]]* [[THIS:%[a-zA-Z0-9.]+]], [[A]]** [[THISADDR]] - // CHECK-NEXT: store i64 [[X:%[a-zA-Z0-9.]+]], i64* [[XADDR]] - // CHECK-NEXT: [[THIS1:%[a-zA-Z0-9.]+]] = load [[A]]*, [[A]]** [[THISADDR]] + // CHECK-NEXT: store ptr [[THIS:%[a-zA-Z0-9.]+]], ptr [[THISADDR]] + // CHECK-NEXT: store i64 [[X:%[a-zA-Z0-9.]+]], ptr [[XADDR]] + // CHECK-NEXT: [[THIS1:%[a-zA-Z0-9.]+]] = load ptr, ptr [[THISADDR]] // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 1}} // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} - // CHECK-NEXT: [[TMP:%[a-zA-Z0-9.]+]] = load i64, i64* [[XADDR]] + // CHECK-NEXT: [[TMP:%[a-zA-Z0-9.]+]] = load i64, ptr [[XADDR]] // CHECK-NEXT: [[CONV:%[a-zA-Z0-9.]+]] = trunc i64 [[TMP]] to i32 // CHECK-NEXT: store i32 [[CONV]] // CHECK-NEXT: ret void @@ -133,13 +133,11 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test31AC2Ev( // CHECK: [[THIS:%.*]] = load // CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0 - // CHECK-NEXT: [[STRUCT:%.*]] = bitcast {{.*}}* [[UNION]] to - // CHECK-NEXT: [[CALLBACK:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 0 + // CHECK-NEXT: [[CALLBACK:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0 // CHECK: store // CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0 - // CHECK-NEXT: [[STRUCT:%.*]] = bitcast {{.*}}* [[UNION]] to - // CHECK-NEXT: [[CVALUE:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 1 - // CHECK-NEXT: store i8* null, i8** [[CVALUE]] + // CHECK-NEXT: [[CVALUE:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 1 + // CHECK-NEXT: store ptr null, ptr [[CVALUE]] } struct S { diff --git a/clang/test/CodeGenCXX/arm-swiftcall.cpp b/clang/test/CodeGenCXX/arm-swiftcall.cpp --- a/clang/test/CodeGenCXX/arm-swiftcall.cpp +++ b/clang/test/CodeGenCXX/arm-swiftcall.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK +// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK // This isn't really testing anything ARM-specific; it's just a convenient // 32-bit platform. @@ -49,15 +49,14 @@ // CHECK-LABEL: define {{.*}} @return_struct_1() // CHECK: [[RET:%.*]] = alloca [[REC:%.*]], align 4 // CHECK: @llvm.memset -// CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, \[2 x i8\], i8, \[1 x i8\], float, float }]]* -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 -// CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 -// CHECK: [[SECOND:%.*]] = load i8, i8* [[T0]], align 2 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 -// CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 5 -// CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG:{ i32, \[2 x i8\], i8, \[1 x i8\], float, float }]], ptr [[RET]], i32 0, i32 0 +// CHECK: [[FIRST:%.*]] = load i32, ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[RET]], i32 0, i32 2 +// CHECK: [[SECOND:%.*]] = load i8, ptr [[T0]], align 2 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[RET]], i32 0, i32 4 +// CHECK: [[THIRD:%.*]] = load float, ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[RET]], i32 0, i32 5 +// CHECK: [[FOURTH:%.*]] = load float, ptr [[T0]], align 4 // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ i32, i8, float, float }]] poison, i32 [[FIRST]], 0 // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i8 [[SECOND]], 1 // CHECK: [[T2:%.*]] = insertvalue [[UAGG]] [[T1]], float [[THIRD]], 2 @@ -65,41 +64,38 @@ // CHECK: ret [[UAGG]] [[T3]] // CHECK-LABEL: define {{.*}} @take_struct_1(i32 %0, i8 %1, float %2, float %3) // CHECK: [[V:%.*]] = alloca [[REC]], align 4 -// CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 -// CHECK: store i32 %0, i32* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 -// CHECK: store i8 %1, i8* [[T0]], align 2 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 -// CHECK: store float %2, float* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 5 -// CHECK: store float %3, float* [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[V]], i32 0, i32 0 +// CHECK: store i32 %0, ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[V]], i32 0, i32 2 +// CHECK: store i8 %1, ptr [[T0]], align 2 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[V]], i32 0, i32 4 +// CHECK: store float %2, ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[V]], i32 0, i32 5 +// CHECK: store float %3, ptr [[T0]], align 4 // CHECK: ret void // CHECK-LABEL: define{{.*}} void @test_struct_1() // CHECK: [[TMP:%.*]] = alloca [[REC]], align 4 // CHECK: [[CALL:%.*]] = call [[SWIFTCC:swiftcc]] [[UAGG]] @return_struct_1() -// CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 0 // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 -// CHECK: store i32 [[T1]], i32* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 +// CHECK: store i32 [[T1]], ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 2 // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 -// CHECK: store i8 [[T1]], i8* [[T0]], align 2 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 +// CHECK: store i8 [[T1]], ptr [[T0]], align 2 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 4 // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 2 -// CHECK: store float [[T1]], float* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 5 +// CHECK: store float [[T1]], ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 5 // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 3 -// CHECK: store float [[T1]], float* [[T0]], align 4 -// CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 -// CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 -// CHECK: [[SECOND:%.*]] = load i8, i8* [[T0]], align 2 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 -// CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align 4 -// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 5 -// CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align 4 +// CHECK: store float [[T1]], ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 0 +// CHECK: [[FIRST:%.*]] = load i32, ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 2 +// CHECK: [[SECOND:%.*]] = load i8, ptr [[T0]], align 2 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 4 +// CHECK: [[THIRD:%.*]] = load float, ptr [[T0]], align 4 +// CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], ptr [[TMP]], i32 0, i32 5 +// CHECK: [[FOURTH:%.*]] = load float, ptr [[T0]], align 4 // CHECK: call [[SWIFTCC]] void @take_struct_1(i32 [[FIRST]], i8 [[SECOND]], float [[THIRD]], float [[FOURTH]]) // CHECK: ret void @@ -112,7 +108,7 @@ // CHECK-LABEL: define {{.*}} void @return_struct_indirect_1({{.*}} noalias sret // Should not be byval. -// CHECK-LABEL: define {{.*}} void @take_struct_indirect_1({{.*}}* noundef{{( %.*)?}}) +// CHECK-LABEL: define {{.*}} void @take_struct_indirect_1(ptr noundef{{( %.*)?}}) // Do a simple standalone test here of a function definition to ensure that // we don't have problems due to failure to eagerly synthesize a copy diff --git a/clang/test/CodeGenCXX/arm.cpp b/clang/test/CodeGenCXX/arm.cpp --- a/clang/test/CodeGenCXX/arm.cpp +++ b/clang/test/CodeGenCXX/arm.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++98 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++11 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s +// RUN: %clang_cc1 -no-enable-noundef-analysis %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++98 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s +// RUN: %clang_cc1 -no-enable-noundef-analysis %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++11 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4 // CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0 @@ -26,12 +26,12 @@ // PR9593 // Make sure atexit(3) is used for global dtors. -// CHECK: call [[BAR:%.*]]* @_ZN3barC1Ev( -// CHECK-NEXT: call i32 @atexit(void ()* @__dtor_baz) +// CHECK: call ptr @_ZN3barC1Ev( +// CHECK-NEXT: call i32 @atexit(ptr @__dtor_baz) // CHECK-NOT: @_GLOBAL__D_a() // CHECK-LABEL: define internal void @__dtor_baz() -// CHECK: call [[BAR]]* @_ZN3barD1Ev([[BAR]]* @baz) +// CHECK: call ptr @_ZN3barD1Ev(ptr @baz) // Destructors and constructors must return this. namespace test1 { @@ -46,27 +46,27 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test14testEv() void test() { // CHECK: [[AV:%.*]] = alloca [[A:%.*]], align 1 - // CHECK: call [[A]]* @_ZN5test11AC1Ei([[A]]* {{[^,]*}} [[AV]], i32 10) - // CHECK: invoke void @_ZN5test11A3barEv([[A]]* {{[^,]*}} [[AV]]) - // CHECK: call [[A]]* @_ZN5test11AD1Ev([[A]]* {{[^,]*}} [[AV]]) + // CHECK: call ptr @_ZN5test11AC1Ei(ptr {{[^,]*}} [[AV]], i32 10) + // CHECK: invoke void @_ZN5test11A3barEv(ptr {{[^,]*}} [[AV]]) + // CHECK: call ptr @_ZN5test11AD1Ev(ptr {{[^,]*}} [[AV]]) // CHECK: ret void A a = 10; a.bar(); } - // CHECK: define linkonce_odr [[A]]* @_ZN5test11AC1Ei([[A]]* {{[^,]*}} returned {{[^,]*}} %this, i32 %i) unnamed_addr - // CHECK: [[THIS:%.*]] = alloca [[A]]*, align 4 - // CHECK: store [[A]]* {{.*}}, [[A]]** [[THIS]] - // CHECK: [[THIS1:%.*]] = load [[A]]*, [[A]]** [[THIS]] - // CHECK: {{%.*}} = call [[A]]* @_ZN5test11AC2Ei( - // CHECK: ret [[A]]* [[THIS1]] - - // CHECK: define linkonce_odr [[A]]* @_ZN5test11AD1Ev([[A]]* {{[^,]*}} returned {{[^,]*}} %this) unnamed_addr - // CHECK: [[THIS:%.*]] = alloca [[A]]*, align 4 - // CHECK: store [[A]]* {{.*}}, [[A]]** [[THIS]] - // CHECK: [[THIS1:%.*]] = load [[A]]*, [[A]]** [[THIS]] - // CHECK: {{%.*}} = call [[A]]* @_ZN5test11AD2Ev( - // CHECK: ret [[A]]* [[THIS1]] + // CHECK: define linkonce_odr ptr @_ZN5test11AC1Ei(ptr {{[^,]*}} returned {{[^,]*}} %this, i32 %i) unnamed_addr + // CHECK: [[THIS:%.*]] = alloca ptr, align 4 + // CHECK: store ptr {{.*}}, ptr [[THIS]] + // CHECK: [[THIS1:%.*]] = load ptr, ptr [[THIS]] + // CHECK: {{%.*}} = call ptr @_ZN5test11AC2Ei( + // CHECK: ret ptr [[THIS1]] + + // CHECK: define linkonce_odr ptr @_ZN5test11AD1Ev(ptr {{[^,]*}} returned {{[^,]*}} %this) unnamed_addr + // CHECK: [[THIS:%.*]] = alloca ptr, align 4 + // CHECK: store ptr {{.*}}, ptr [[THIS]] + // CHECK: [[THIS1:%.*]] = load ptr, ptr [[THIS]] + // CHECK: {{%.*}} = call ptr @_ZN5test11AD2Ev( + // CHECK: ret ptr [[THIS1]] } // Awkward virtual cases. @@ -110,7 +110,7 @@ void a() { // CHECK-LABEL: define{{.*}} void @_ZN5test31aEv() - // CHECK: call noalias nonnull i8* @_Znam(i32 48) + // CHECK: call noalias nonnull ptr @_Znam(i32 48) // CHECK: store i32 4 // CHECK: store i32 10 A *x = new A[10]; @@ -118,12 +118,12 @@ void b(int n) { // CHECK-LABEL: define{{.*}} void @_ZN5test31bEi( - // CHECK: [[N:%.*]] = load i32, i32* + // CHECK: [[N:%.*]] = load i32, ptr // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 4) // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) // CHECK: [[OR:%.*]] = or i1 // CHECK: [[SZ:%.*]] = select i1 [[OR]] - // CHECK: call noalias nonnull i8* @_Znam(i32 [[SZ]]) + // CHECK: call noalias nonnull ptr @_Znam(i32 [[SZ]]) // CHECK: store i32 4 // CHECK: store i32 [[N]] A *x = new A[n]; @@ -131,7 +131,7 @@ void c() { // CHECK-LABEL: define{{.*}} void @_ZN5test31cEv() - // CHECK: call noalias nonnull i8* @_Znam(i32 808) + // CHECK: call noalias nonnull ptr @_Znam(i32 808) // CHECK: store i32 4 // CHECK: store i32 200 A (*x)[20] = new A[10][20]; @@ -139,12 +139,12 @@ void d(int n) { // CHECK-LABEL: define{{.*}} void @_ZN5test31dEi( - // CHECK: [[N:%.*]] = load i32, i32* + // CHECK: [[N:%.*]] = load i32, ptr // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 80) // CHECK: [[NE:%.*]] = mul i32 [[N]], 20 // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) // CHECK: [[SZ:%.*]] = select - // CHECK: call noalias nonnull i8* @_Znam(i32 [[SZ]]) + // CHECK: call noalias nonnull ptr @_Znam(i32 [[SZ]]) // CHECK: store i32 4 // CHECK: store i32 [[NE]] A (*x)[20] = new A[n][20]; @@ -155,7 +155,6 @@ // CHECK: icmp eq {{.*}}, null // CHECK: getelementptr {{.*}}, i32 -8 // CHECK: getelementptr {{.*}}, i32 4 - // CHECK: bitcast {{.*}} to i32* // CHECK: load // CHECK98: invoke {{.*}} @_ZN5test31AD1Ev // CHECK11: call {{.*}} @_ZN5test31AD1Ev @@ -168,7 +167,6 @@ // CHECK: icmp eq {{.*}}, null // CHECK: getelementptr {{.*}}, i32 -8 // CHECK: getelementptr {{.*}}, i32 4 - // CHECK: bitcast {{.*}} to i32* // CHECK: load // CHECK98: invoke {{.*}} @_ZN5test31AD1Ev // CHECK11: call {{.*}} @_ZN5test31AD1Ev @@ -185,7 +183,7 @@ void a() { // CHECK-LABEL: define{{.*}} void @_ZN5test41aEv() - // CHECK: call noalias nonnull i8* @_Znam(i32 48) + // CHECK: call noalias nonnull ptr @_Znam(i32 48) // CHECK: store i32 4 // CHECK: store i32 10 A *x = new A[10]; @@ -193,11 +191,11 @@ void b(int n) { // CHECK-LABEL: define{{.*}} void @_ZN5test41bEi( - // CHECK: [[N:%.*]] = load i32, i32* + // CHECK: [[N:%.*]] = load i32, ptr // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 4) // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) // CHECK: [[SZ:%.*]] = select - // CHECK: call noalias nonnull i8* @_Znam(i32 [[SZ]]) + // CHECK: call noalias nonnull ptr @_Znam(i32 [[SZ]]) // CHECK: store i32 4 // CHECK: store i32 [[N]] A *x = new A[n]; @@ -205,7 +203,7 @@ void c() { // CHECK-LABEL: define{{.*}} void @_ZN5test41cEv() - // CHECK: call noalias nonnull i8* @_Znam(i32 808) + // CHECK: call noalias nonnull ptr @_Znam(i32 808) // CHECK: store i32 4 // CHECK: store i32 200 A (*x)[20] = new A[10][20]; @@ -213,12 +211,12 @@ void d(int n) { // CHECK-LABEL: define{{.*}} void @_ZN5test41dEi( - // CHECK: [[N:%.*]] = load i32, i32* + // CHECK: [[N:%.*]] = load i32, ptr // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 80) // CHECK: [[NE:%.*]] = mul i32 [[N]], 20 // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) // CHECK: [[SZ:%.*]] = select - // CHECK: call noalias nonnull i8* @_Znam(i32 [[SZ]]) + // CHECK: call noalias nonnull ptr @_Znam(i32 [[SZ]]) // CHECK: store i32 4 // CHECK: store i32 [[NE]] A (*x)[20] = new A[n][20]; @@ -228,11 +226,10 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test41eEPNS_1AE( // CHECK: [[ALLOC:%.*]] = getelementptr inbounds {{.*}}, i32 -8 // CHECK: getelementptr inbounds {{.*}}, i32 4 - // CHECK: bitcast - // CHECK: [[T0:%.*]] = load i32, i32* + // CHECK: [[T0:%.*]] = load i32, ptr // CHECK: [[T1:%.*]] = mul i32 4, [[T0]] // CHECK: [[T2:%.*]] = add i32 [[T1]], 8 - // CHECK: call void @_ZN5test41AdaEPvm(i8* [[ALLOC]], i32 [[T2]]) + // CHECK: call void @_ZN5test41AdaEPvm(ptr [[ALLOC]], i32 [[T2]]) delete [] x; } @@ -240,11 +237,10 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test41fEPA20_NS_1AE( // CHECK: [[ALLOC:%.*]] = getelementptr inbounds {{.*}}, i32 -8 // CHECK: getelementptr inbounds {{.*}}, i32 4 - // CHECK: bitcast - // CHECK: [[T0:%.*]] = load i32, i32* + // CHECK: [[T0:%.*]] = load i32, ptr // CHECK: [[T1:%.*]] = mul i32 4, [[T0]] // CHECK: [[T2:%.*]] = add i32 [[T1]], 8 - // CHECK: call void @_ZN5test41AdaEPvm(i8* [[ALLOC]], i32 [[T2]]) + // CHECK: call void @_ZN5test41AdaEPvm(ptr [[ALLOC]], i32 [[T2]]) delete [] x; } } @@ -257,10 +253,10 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test54testEPNS_1AE void test(A *a) { - // CHECK: [[PTR:%.*]] = alloca [[A:%.*]]*, align 4 - // CHECK-NEXT: store [[A]]* {{.*}}, [[A]]** [[PTR]], align 4 - // CHECK-NEXT: [[TMP:%.*]] = load [[A]]*, [[A]]** [[PTR]], align 4 - // CHECK-NEXT: call [[A]]* @_ZN5test51AD1Ev([[A]]* {{[^,]*}} [[TMP]]) + // CHECK: [[PTR:%.*]] = alloca ptr, align 4 + // CHECK-NEXT: store ptr {{.*}}, ptr [[PTR]], align 4 + // CHECK-NEXT: [[TMP:%.*]] = load ptr, ptr [[PTR]], align 4 + // CHECK-NEXT: call ptr @_ZN5test51AD1Ev(ptr {{[^,]*}} [[TMP]]) // CHECK-NEXT: ret void a->~A(); } @@ -273,16 +269,15 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test64testEPNS_1AE void test(A *a) { - // CHECK: [[AVAR:%.*]] = alloca [[A:%.*]]*, align 4 - // CHECK-NEXT: store [[A]]* {{.*}}, [[A]]** [[AVAR]], align 4 - // CHECK-NEXT: [[V:%.*]] = load [[A]]*, [[A]]** [[AVAR]], align 4 - // CHECK-NEXT: [[ISNULL:%.*]] = icmp eq [[A]]* [[V]], null + // CHECK: [[AVAR:%.*]] = alloca ptr, align 4 + // CHECK-NEXT: store ptr {{.*}}, ptr [[AVAR]], align 4 + // CHECK-NEXT: [[V:%.*]] = load ptr, ptr [[AVAR]], align 4 + // CHECK-NEXT: [[ISNULL:%.*]] = icmp eq ptr [[V]], null // CHECK-NEXT: br i1 [[ISNULL]] - // CHECK: [[T0:%.*]] = bitcast [[A]]* [[V]] to void ([[A]]*)*** - // CHECK-NEXT: [[T1:%.*]] = load void ([[A]]*)**, void ([[A]]*)*** [[T0]] - // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds void ([[A]]*)*, void ([[A]]*)** [[T1]], i64 1 - // CHECK-NEXT: [[T3:%.*]] = load void ([[A]]*)*, void ([[A]]*)** [[T2]] - // CHECK-NEXT: call void [[T3]]([[A]]* {{[^,]*}} [[V]]) + // CHECK: [[T1:%.*]] = load ptr, ptr [[V]] + // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds ptr, ptr [[T1]], i64 1 + // CHECK-NEXT: [[T3:%.*]] = load ptr, ptr [[T2]] + // CHECK-NEXT: call void [[T3]](ptr {{[^,]*}} [[V]]) // CHECK-NEXT: br label // CHECK: ret void delete a; @@ -294,30 +289,30 @@ // Static and guard tested at top of file - // CHECK-LABEL: define{{.*}} void @_ZN5test74testEv() {{.*}} personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-LABEL: define{{.*}} void @_ZN5test74testEv() {{.*}} personality ptr @__gxx_personality_v0 void test() { - // CHECK: [[T0:%.*]] = load atomic i8, i8* bitcast (i32* @_ZGVZN5test74testEvE1x to i8*) acquire, align 4 + // CHECK: [[T0:%.*]] = load atomic i8, ptr @_ZGVZN5test74testEvE1x acquire, align 4 // CHECK-NEXT: [[T1:%.*]] = and i8 [[T0]], 1 // CHECK-NEXT: [[T2:%.*]] = icmp eq i8 [[T1]], 0 // CHECK-NEXT: br i1 [[T2]] // -> fallthrough, end - // CHECK: [[T3:%.*]] = call i32 @__cxa_guard_acquire(i32* @_ZGVZN5test74testEvE1x) + // CHECK: [[T3:%.*]] = call i32 @__cxa_guard_acquire(ptr @_ZGVZN5test74testEvE1x) // CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0 // CHECK-NEXT: br i1 [[T4]] // -> fallthrough, end // CHECK: [[INIT:%.*]] = invoke i32 @_ZN5test73fooEv() - // CHECK: store i32 [[INIT]], i32* @_ZZN5test74testEvE1x, align 4 - // CHECK-NEXT: call void @__cxa_guard_release(i32* @_ZGVZN5test74testEvE1x) + // CHECK: store i32 [[INIT]], ptr @_ZZN5test74testEvE1x, align 4 + // CHECK-NEXT: call void @__cxa_guard_release(ptr @_ZGVZN5test74testEvE1x) // CHECK-NEXT: br label // -> end // end: // CHECK: ret void static int x = foo(); - // CHECK: landingpad { i8*, i32 } + // CHECK: landingpad { ptr, i32 } // CHECK-NEXT: cleanup - // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test74testEvE1x) - // CHECK: resume { i8*, i32 } + // CHECK: call void @__cxa_guard_abort(ptr @_ZGVZN5test74testEvE1x) + // CHECK: resume { ptr, i32 } } } @@ -329,35 +324,35 @@ // Static and guard tested at top of file - // CHECK-LABEL: define{{.*}} void @_ZN5test84testEv() {{.*}} personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-LABEL: define{{.*}} void @_ZN5test84testEv() {{.*}} personality ptr @__gxx_personality_v0 void test() { - // CHECK: [[T0:%.*]] = load atomic i8, i8* bitcast (i32* @_ZGVZN5test84testEvE1x to i8*) acquire, align 4 + // CHECK: [[T0:%.*]] = load atomic i8, ptr @_ZGVZN5test84testEvE1x acquire, align 4 // CHECK-NEXT: [[T1:%.*]] = and i8 [[T0]], 1 // CHECK-NEXT: [[T2:%.*]] = icmp eq i8 [[T1]], 0 // CHECK-NEXT: br i1 [[T2]] // -> fallthrough, end - // CHECK: [[T3:%.*]] = call i32 @__cxa_guard_acquire(i32* @_ZGVZN5test84testEvE1x) + // CHECK: [[T3:%.*]] = call i32 @__cxa_guard_acquire(ptr @_ZGVZN5test84testEvE1x) // CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0 // CHECK-NEXT: br i1 [[T4]] // -> fallthrough, end - // CHECK: [[INIT:%.*]] = invoke [[TEST8A]]* @_ZN5test81AC1Ev([[TEST8A]]* {{[^,]*}} @_ZZN5test84testEvE1x) + // CHECK: [[INIT:%.*]] = invoke ptr @_ZN5test81AC1Ev(ptr {{[^,]*}} @_ZZN5test84testEvE1x) // FIXME: Here we register a global destructor that // unconditionally calls the destructor. That's what we've always // done for -fno-use-cxa-atexit here, but that's really not // semantically correct at all. - // CHECK: call void @__cxa_guard_release(i32* @_ZGVZN5test84testEvE1x) + // CHECK: call void @__cxa_guard_release(ptr @_ZGVZN5test84testEvE1x) // CHECK-NEXT: br label // -> end // end: // CHECK: ret void static A x; - // CHECK: landingpad { i8*, i32 } + // CHECK: landingpad { ptr, i32 } // CHECK-NEXT: cleanup - // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test84testEvE1x) - // CHECK: resume { i8*, i32 } + // CHECK: call void @__cxa_guard_abort(ptr @_ZGVZN5test84testEvE1x) + // CHECK: resume { ptr, i32 } } } @@ -375,9 +370,9 @@ A *testNew(unsigned n) { return new A[n]; } -// CHECK: define{{.*}} [[TEST9:%.*]]* @_ZN5test97testNewEj(i32 +// CHECK: define{{.*}} ptr @_ZN5test97testNewEj(i32 // CHECK: [[N_VAR:%.*]] = alloca i32, align 4 -// CHECK: [[N:%.*]] = load i32, i32* [[N_VAR]], align 4 +// CHECK: [[N:%.*]] = load i32, ptr [[N_VAR]], align 4 // CHECK-NEXT: [[T0:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[N]], i32 16) // CHECK-NEXT: [[O0:%.*]] = extractvalue { i32, i1 } [[T0]], 1 // CHECK-NEXT: [[T1:%.*]] = extractvalue { i32, i1 } [[T0]], 0 @@ -386,36 +381,32 @@ // CHECK-NEXT: [[OVERFLOW:%.*]] = or i1 [[O0]], [[O1]] // CHECK-NEXT: [[T3:%.*]] = extractvalue { i32, i1 } [[T2]], 0 // CHECK-NEXT: [[T4:%.*]] = select i1 [[OVERFLOW]], i32 -1, i32 [[T3]] -// CHECK-NEXT: [[ALLOC:%.*]] = call noalias nonnull i8* @_Znam(i32 [[T4]]) -// CHECK-NEXT: [[T0:%.*]] = bitcast i8* [[ALLOC]] to i32* -// CHECK-NEXT: store i32 16, i32* [[T0]] -// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i32, i32* [[T0]], i32 1 -// CHECK-NEXT: store i32 [[N]], i32* [[T1]] -// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds i8, i8* [[ALLOC]], i32 16 -// CHECK-NEXT: bitcast i8* [[T0]] to [[TEST9]]* +// CHECK-NEXT: [[ALLOC:%.*]] = call noalias nonnull ptr @_Znam(i32 [[T4]]) +// CHECK-NEXT: store i32 16, ptr [[ALLOC]] +// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i32, ptr [[ALLOC]], i32 1 +// CHECK-NEXT: store i32 [[N]], ptr [[T1]] +// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds i8, ptr [[ALLOC]], i32 16 // Array allocation follows. void testDelete(A *array) { delete[] array; } // CHECK-LABEL: define{{.*}} void @_ZN5test910testDeleteEPNS_1AE( -// CHECK: [[BEGIN:%.*]] = load [[TEST9]]*, [[TEST9]]** -// CHECK-NEXT: [[T0:%.*]] = icmp eq [[TEST9]]* [[BEGIN]], null +// CHECK: [[BEGIN:%.*]] = load ptr, ptr +// CHECK-NEXT: [[T0:%.*]] = icmp eq ptr [[BEGIN]], null // CHECK-NEXT: br i1 [[T0]], -// CHECK: [[T0:%.*]] = bitcast [[TEST9]]* [[BEGIN]] to i8* -// CHECK-NEXT: [[ALLOC:%.*]] = getelementptr inbounds i8, i8* [[T0]], i32 -16 -// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds i8, i8* [[ALLOC]], i32 4 -// CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to i32* -// CHECK-NEXT: [[N:%.*]] = load i32, i32* [[T1]] -// CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [[TEST9]], [[TEST9]]* [[BEGIN]], i32 [[N]] -// CHECK-NEXT: [[T0:%.*]] = icmp eq [[TEST9]]* [[BEGIN]], [[END]] +// CHECK: [[ALLOC:%.*]] = getelementptr inbounds i8, ptr [[BEGIN]], i32 -16 +// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds i8, ptr [[ALLOC]], i32 4 +// CHECK-NEXT: [[N:%.*]] = load i32, ptr [[T0]] +// CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [[TEST9:%.*]], ptr [[BEGIN]], i32 [[N]] +// CHECK-NEXT: [[T0:%.*]] = icmp eq ptr [[BEGIN]], [[END]] // CHECK-NEXT: br i1 [[T0]], // Array deallocation follows. } - // CHECK: define linkonce_odr [[C:%.*]]* @_ZTv0_n12_N5test21CD1Ev( - // CHECK: call [[C]]* @_ZN5test21CD1Ev( - // CHECK: ret [[C]]* undef + // CHECK: define linkonce_odr ptr @_ZTv0_n12_N5test21CD1Ev( + // CHECK: call ptr @_ZN5test21CD1Ev( + // CHECK: ret ptr undef // CHECK-LABEL: define linkonce_odr void @_ZTv0_n12_N5test21CD0Ev( // CHECK: call void @_ZN5test21CD0Ev( diff --git a/clang/test/CodeGenCXX/arm64.cpp b/clang/test/CodeGenCXX/arm64.cpp --- a/clang/test/CodeGenCXX/arm64.cpp +++ b/clang/test/CodeGenCXX/arm64.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=arm64-apple-ios -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=arm64-apple-ios -emit-llvm -o - | FileCheck -check-prefix=CHECK-GLOBALS %s +// RUN: %clang_cc1 %s -triple=arm64-apple-ios -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=arm64-apple-ios -emit-llvm -o - | FileCheck -check-prefix=CHECK-GLOBALS %s // __cxa_guard_acquire argument is 64-bit // rdar://11540122 @@ -8,7 +8,7 @@ }; void f() { - // CHECK: call i32 @__cxa_guard_acquire(i64* + // CHECK: call i32 @__cxa_guard_acquire(ptr static A a; } @@ -46,25 +46,25 @@ }; void A::foo() {} // CHECK-GLOBALS-DAG: @_ZTSN5test21AE ={{.*}} constant [11 x i8] - // CHECK-GLOBALS-DAG: @_ZTIN5test21AE ={{.*}} constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21AE, i32 0, i32 0) } + // CHECK-GLOBALS-DAG: @_ZTIN5test21AE ={{.*}} constant { {{.*}}, ptr @_ZTSN5test21AE } struct __attribute__((visibility("hidden"))) B {}; const std::type_info &b0 = typeid(B); // CHECK-GLOBALS-DAG: @_ZTSN5test21BE = linkonce_odr hidden constant - // CHECK-GLOBALS-DAG: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21BE, i32 0, i32 0) } + // CHECK-GLOBALS-DAG: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, ptr @_ZTSN5test21BE } const std::type_info &b1 = typeid(B*); // CHECK-GLOBALS-DAG: @_ZTSPN5test21BE = linkonce_odr hidden constant - // CHECK-GLOBALS-DAG: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @_ZTSPN5test21BE, i32 0, i32 0), i32 0, i8* bitcast + // CHECK-GLOBALS-DAG: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, ptr @_ZTSPN5test21BE, i32 0, ptr @_ZTIN5test21BE struct C {}; const std::type_info &c0 = typeid(C); // CHECK-GLOBALS-DAG: @_ZTSN5test21CE = linkonce_odr hidden constant - // CHECK-GLOBALS-DAG: @_ZTIN5test21CE = linkonce_odr hidden constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([11 x i8]* @_ZTSN5test21CE to i64), i64 -9223372036854775808) to i8*) } + // CHECK-GLOBALS-DAG: @_ZTIN5test21CE = linkonce_odr hidden constant { {{.*}}, ptr inttoptr (i64 add (i64 ptrtoint (ptr @_ZTSN5test21CE to i64), i64 -9223372036854775808) to ptr) } const std::type_info &c1 = typeid(C*); // CHECK-GLOBALS-DAG: @_ZTSPN5test21CE = linkonce_odr hidden constant - // CHECK-GLOBALS-DAG: @_ZTIPN5test21CE = linkonce_odr hidden constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([12 x i8]* @_ZTSPN5test21CE to i64), i64 -9223372036854775808) to i8*), i32 0, i8* bitcast + // CHECK-GLOBALS-DAG: @_ZTIPN5test21CE = linkonce_odr hidden constant { {{.*}}, ptr inttoptr (i64 add (i64 ptrtoint (ptr @_ZTSPN5test21CE to i64), i64 -9223372036854775808) to ptr), i32 0, ptr @_ZTIN5test21CE // This class is explicitly-instantiated, but that instantiation // doesn't guarantee to emit RTTI, so we can still demote the visibility. @@ -72,7 +72,7 @@ template class D; const std::type_info &d0 = typeid(D); // CHECK-GLOBALS-DAG: @_ZTSN5test21DIiEE = linkonce_odr hidden constant - // CHECK-GLOBALS-DAG: @_ZTIN5test21DIiEE = linkonce_odr hidden constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([14 x i8]* @_ZTSN5test21DIiEE to i64), i64 -9223372036854775808) to i8*) } + // CHECK-GLOBALS-DAG: @_ZTIN5test21DIiEE = linkonce_odr hidden constant { {{.*}}, ptr inttoptr (i64 add (i64 ptrtoint (ptr @_ZTSN5test21DIiEE to i64), i64 -9223372036854775808) to ptr) } // This class is explicitly-instantiated and *does* guarantee to // emit RTTI, so we're stuck with having to use default visibility. @@ -81,7 +81,7 @@ }; template class E; // CHECK-GLOBALS-DAG: @_ZTSN5test21EIiEE = weak_odr constant [14 x i8] - // CHECK-GLOBALS-DAG: @_ZTIN5test21EIiEE = weak_odr constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([14 x i8]* @_ZTSN5test21EIiEE to i64), i64 -9223372036854775808) to i8*) } + // CHECK-GLOBALS-DAG: @_ZTIN5test21EIiEE = weak_odr constant { {{.*}}, ptr inttoptr (i64 add (i64 ptrtoint (ptr @_ZTSN5test21EIiEE to i64), i64 -9223372036854775808) to ptr) } } @@ -99,23 +99,19 @@ // CHECK-LABEL: define{{.*}} void @_ZN5test34testEv() // CHECK: [[TEMP:%.*]] = alloca [[A:.*]], align 8 - // CHECK: [[MEMPTR:%.*]] = load { i64, i64 }, { i64, i64 }* @_ZN5test34mptrE, align 8 + // CHECK: [[MEMPTR:%.*]] = load { i64, i64 }, ptr @_ZN5test34mptrE, align 8 // CHECK: [[ADJUST_AND_IS_VIRTUAL:%.*]] = extractvalue { i64, i64 } [[MEMPTR]], 1 // CHECK: [[ADJUST:%.*]] = ashr i64 [[ADJUST_AND_IS_VIRTUAL]], 1 - // CHECK: [[T0:%.*]] = bitcast [[A]]* [[TEMP]] to i8* - // CHECK: [[T1:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 [[ADJUST]] - // CHECK: [[ADJUSTED:%.*]] = bitcast i8* [[T1]] to [[A]]* + // CHECK: [[T1:%.*]] = getelementptr inbounds i8, ptr [[TEMP]], i64 [[ADJUST]] // CHECK: [[MEMBER:%.*]] = extractvalue { i64, i64 } [[MEMPTR]], 0 // CHECK: [[T0:%.*]] = and i64 [[ADJUST_AND_IS_VIRTUAL]], 1 // CHECK: [[IS_VIRTUAL:%.*]] = icmp ne i64 [[T0]], 0 // CHECK: br i1 [[IS_VIRTUAL]], - // CHECK: [[T0:%.*]] = bitcast [[A]]* [[ADJUSTED]] to i8** - // CHECK: [[VPTR:%.*]] = load i8*, i8** [[T0]], align 8 + // CHECK: [[VPTR:%.*]] = load ptr, ptr [[T1]], align 8 // CHECK: [[TRUNC:%.*]] = trunc i64 [[MEMBER]] to i32 // CHECK: [[ZEXT:%.*]] = zext i32 [[TRUNC]] to i64 - // CHECK: [[T0:%.*]] = getelementptr i8, i8* [[VPTR]], i64 [[ZEXT]] - // CHECK: [[T1:%.*]] = bitcast i8* [[T0]] to void ([[A]]*)** - // CHECK: load void ([[A]]*)*, void ([[A]]*)** [[T1]], + // CHECK: [[T0:%.*]] = getelementptr i8, ptr [[VPTR]], i64 [[ZEXT]] + // CHECK: load ptr, ptr [[T0]], void test() { (A().*mptr)(); } diff --git a/clang/test/CodeGenCXX/armv7k.cpp b/clang/test/CodeGenCXX/armv7k.cpp --- a/clang/test/CodeGenCXX/armv7k.cpp +++ b/clang/test/CodeGenCXX/armv7k.cpp @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck -check-prefix=CHECK-GLOBALS %s +// RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck %s +// RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck -check-prefix=CHECK-GLOBALS %s -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=arm64_32-apple-ios -emit-llvm -o - -target-abi darwinpcs | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=arm64_32-apple-ios -emit-llvm -o - -target-abi darwinpcs | FileCheck -check-prefix=CHECK-GLOBALS %s +// RUN: %clang_cc1 %s -triple=arm64_32-apple-ios -emit-llvm -o - -target-abi darwinpcs | FileCheck %s +// RUN: %clang_cc1 %s -triple=arm64_32-apple-ios -emit-llvm -o - -target-abi darwinpcs | FileCheck -check-prefix=CHECK-GLOBALS %s // __cxa_guard_acquire argument is 64-bit // rdar://11540122 @@ -11,7 +11,7 @@ }; void f() { - // CHECK: call i32 @__cxa_guard_acquire(i32* + // CHECK: call i32 @__cxa_guard_acquire(ptr static A a; } @@ -53,19 +53,19 @@ struct __attribute__((visibility("hidden"))) B {}; const std::type_info &b0 = typeid(B); // CHECK-GLOBALS: @_ZTSN5test21BE = linkonce_odr hidden constant - // CHECK-GLOBALS: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21BE, i32 0, i32 0) } + // CHECK-GLOBALS: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, ptr @_ZTSN5test21BE } const std::type_info &b1 = typeid(B*); // CHECK-GLOBALS: @_ZTSPN5test21BE = linkonce_odr hidden constant - // CHECK-GLOBALS: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @_ZTSPN5test21BE, i32 0, i32 0), i32 0, i8* bitcast + // CHECK-GLOBALS: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, ptr @_ZTSPN5test21BE, i32 0, ptr @_ZTIN5test21BE struct C {}; const std::type_info &c0 = typeid(C); // CHECK-GLOBALS: @_ZTSN5test21CE = linkonce_odr constant [11 x i8] c"N5test21CE\00" - // CHECK-GLOBALS: @_ZTIN5test21CE = linkonce_odr constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21CE, i32 0, i32 0) } + // CHECK-GLOBALS: @_ZTIN5test21CE = linkonce_odr constant { {{.*}}, ptr @_ZTSN5test21CE } } -// va_list should be based on "char *" rather than "void *". +// va_list should be based on "char *" rather than "ptr". // CHECK: define{{.*}} void @_Z11whatsVaListPc void whatsVaList(__builtin_va_list l) {} diff --git a/clang/test/CodeGenCXX/assign-operator.cpp b/clang/test/CodeGenCXX/assign-operator.cpp --- a/clang/test/CodeGenCXX/assign-operator.cpp +++ b/clang/test/CodeGenCXX/assign-operator.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 |FileCheck %s +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 |FileCheck %s class x { public: int operator=(int); @@ -13,7 +13,7 @@ // CHECK: load i32 // CHECK: add nsw i32 // CHECK: store i32 - // CHECK: store i32 17, i32 + // CHECK: store i32 17, ptr // CHECK: ret (i += j) = 17; } diff --git a/clang/test/CodeGenCXX/attr-musttail.cpp b/clang/test/CodeGenCXX/attr-musttail.cpp --- a/clang/test/CodeGenCXX/attr-musttail.cpp +++ b/clang/test/CodeGenCXX/attr-musttail.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -fno-elide-constructors -S -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -fno-elide-constructors -S -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | opt -passes=verify +// RUN: %clang_cc1 -fno-elide-constructors -S -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | FileCheck %s +// RUN: %clang_cc1 -fno-elide-constructors -S -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | opt -passes=verify // FIXME: remove the call to "opt" once the tests are running the Clang verifier automatically again. int Bar(int); @@ -36,7 +36,7 @@ [[clang::musttail]] return MemberFunction(x); } -// CHECK: %call = musttail call noundef i32 @_ZN3Foo14MemberFunctionEi(%class.Foo* noundef nonnull align 1 dereferenceable(1) %this1, i32 noundef %0) +// CHECK: %call = musttail call noundef i32 @_ZN3Foo14MemberFunctionEi(ptr noundef nonnull align 1 dereferenceable(1) %this1, i32 noundef %0) int Func3(int x) { [[clang::musttail]] return Foo::StaticMethod(x); @@ -57,13 +57,13 @@ [[clang::musttail]] return ((*this).*pmf)(x); } -// CHECK: %call = musttail call noundef i32 %8(%class.Foo* noundef nonnull align 1 dereferenceable(1) %this.adjusted, i32 noundef %9) +// CHECK: %call = musttail call noundef i32 %5(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %6) int Foo::TailFrom3(int x) { [[clang::musttail]] return (this->*pmf)(x); } -// CHECK: %call = musttail call noundef i32 %8(%class.Foo* noundef nonnull align 1 dereferenceable(1) %this.adjusted, i32 noundef %9) +// CHECK: %call = musttail call noundef i32 %5(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %6) void ReturnsVoid(); @@ -92,7 +92,7 @@ [[clang::musttail]] return data->fptr(data); } -// CHECK: %call = musttail call noundef i32 %1(%struct.Data* noundef %2) +// CHECK: %call = musttail call noundef i32 %1(ptr noundef %2) template T TemplateFunc(T) { @@ -152,7 +152,7 @@ [[clang::musttail]] return ConstMemberFunction(i); } -// CHECK: musttail call void @_ZNK7Struct319ConstMemberFunctionEPKi(%struct.Struct3* noundef nonnull align 1 dereferenceable(1) %this1, i32* noundef %0) +// CHECK: musttail call void @_ZNK7Struct319ConstMemberFunctionEPKi(ptr noundef nonnull align 1 dereferenceable(1) %this1, ptr noundef %0) struct HasNonTrivialCopyConstructor { HasNonTrivialCopyConstructor(const HasNonTrivialCopyConstructor &); @@ -162,7 +162,7 @@ [[clang::musttail]] return (((ReturnsClassByValue()))); } -// CHECK: musttail call void @_Z19ReturnsClassByValuev(%struct.HasNonTrivialCopyConstructor* sret(%struct.HasNonTrivialCopyConstructor) align 1 %agg.result) +// CHECK: musttail call void @_Z19ReturnsClassByValuev(ptr sret(%struct.HasNonTrivialCopyConstructor) align 1 %agg.result) struct HasNonTrivialCopyConstructor2 { // Copy constructor works even if it has extra default params. @@ -191,8 +191,8 @@ [[clang::musttail]] return ReturnsLarge(); } -// CHECK: define dso_local void @_Z28TestLargeWithCopyConstructorv(%struct.LargeWithCopyConstructor* noalias sret(%struct.LargeWithCopyConstructor) align 1 %agg.result) -// CHECK: musttail call void @_Z12ReturnsLargev(%struct.LargeWithCopyConstructor* sret(%struct.LargeWithCopyConstructor) align 1 %agg.result) +// CHECK: define dso_local void @_Z28TestLargeWithCopyConstructorv(ptr noalias sret(%struct.LargeWithCopyConstructor) align 1 %agg.result) +// CHECK: musttail call void @_Z12ReturnsLargev(ptr sret(%struct.LargeWithCopyConstructor) align 1 %agg.result) using IntFunctionType = int(); IntFunctionType *ReturnsIntFunction(); @@ -213,7 +213,7 @@ [[clang::musttail]] return (+lambda)(); } -// CHECK: %call = call noundef i32 ()* @"_ZZ22TestNonCapturingLambdavENK3$_0cvPFivEEv"(%class.anon* noundef nonnull align 1 dereferenceable(1) %lambda) +// CHECK: %call = call noundef ptr @"_ZZ22TestNonCapturingLambdavENK3$_0cvPFivEEv"(ptr noundef nonnull align 1 dereferenceable(1) %lambda) // CHECK: musttail call noundef i32 %call() class TestVirtual { @@ -225,4 +225,4 @@ [[clang::musttail]] return TailTo(); } -// CHECK: musttail call void %1(%class.TestVirtual* noundef nonnull align 8 dereferenceable(8) %this1) +// CHECK: musttail call void %0(ptr noundef nonnull align 8 dereferenceable(8) %this1) diff --git a/clang/test/CodeGenCXX/attr-target-clones.cpp b/clang/test/CodeGenCXX/attr-target-clones.cpp --- a/clang/test/CodeGenCXX/attr-target-clones.cpp +++ b/clang/test/CodeGenCXX/attr-target-clones.cpp @@ -1,20 +1,20 @@ -// RUN: %clang_cc1 -no-opaque-pointers -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX -// RUN: %clang_cc1 -no-opaque-pointers -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS // Overloaded ifuncs -// LINUX: @_Z10overloadedi.ifunc = weak_odr ifunc i32 (i32), i32 (i32)* ()* @_Z10overloadedi.resolver -// LINUX: @_Z10overloadedPKc.ifunc = weak_odr ifunc i32 (i8*), i32 (i8*)* ()* @_Z10overloadedPKc.resolver +// LINUX: @_Z10overloadedi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z10overloadedi.resolver +// LINUX: @_Z10overloadedPKc.ifunc = weak_odr ifunc i32 (ptr), ptr @_Z10overloadedPKc.resolver // struct 'C' ifuncs, note the 'float, U' one doesn't get one. -// LINUX: @_ZN1CIssE3fooEv.ifunc = weak_odr ifunc i32 (%struct.C*), i32 (%struct.C*)* ()* @_ZN1CIssE3fooEv.resolver -// LINUX: @_ZN1CIisE3fooEv.ifunc = weak_odr ifunc i32 (%struct.C.0*), i32 (%struct.C.0*)* ()* @_ZN1CIisE3fooEv.resolver -// LINUX: @_ZN1CIdfE3fooEv.ifunc = weak_odr ifunc i32 (%struct.C.2*), i32 (%struct.C.2*)* ()* @_ZN1CIdfE3fooEv.resolver +// LINUX: @_ZN1CIssE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIssE3fooEv.resolver +// LINUX: @_ZN1CIisE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIisE3fooEv.resolver +// LINUX: @_ZN1CIdfE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIdfE3fooEv.resolver int __attribute__((target_clones("sse4.2", "default"))) overloaded(int) { return 1; } // LINUX: define {{.*}}i32 @_Z10overloadedi.sse4.2.0(i32{{.+}}) // LINUX: define {{.*}}i32 @_Z10overloadedi.default.1(i32{{.+}}) -// LINUX: define weak_odr i32 (i32)* @_Z10overloadedi.resolver() comdat -// LINUX: ret i32 (i32)* @_Z10overloadedi.sse4.2.0 -// LINUX: ret i32 (i32)* @_Z10overloadedi.default.1 +// LINUX: define weak_odr ptr @_Z10overloadedi.resolver() comdat +// LINUX: ret ptr @_Z10overloadedi.sse4.2.0 +// LINUX: ret ptr @_Z10overloadedi.default.1 // WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHH@Z.sse4.2.0"(i32{{.+}}) // WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHH@Z.default.1"(i32{{.+}}) @@ -23,15 +23,15 @@ // WINDOWS: call i32 @"?overloaded@@YAHH@Z.default.1" int __attribute__((target_clones("arch=ivybridge", "default"))) overloaded(const char *) { return 2; } -// LINUX: define {{.*}}i32 @_Z10overloadedPKc.arch_ivybridge.0(i8*{{.+}}) -// LINUX: define {{.*}}i32 @_Z10overloadedPKc.default.1(i8*{{.+}}) -// LINUX: define weak_odr i32 (i8*)* @_Z10overloadedPKc.resolver() comdat -// LINUX: ret i32 (i8*)* @_Z10overloadedPKc.arch_ivybridge.0 -// LINUX: ret i32 (i8*)* @_Z10overloadedPKc.default.1 - -// WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHPEBD@Z.arch_ivybridge.0"(i8*{{.+}}) -// WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHPEBD@Z.default.1"(i8*{{.+}}) -// WINDOWS: define weak_odr dso_local i32 @"?overloaded@@YAHPEBD@Z"(i8*{{.+}}) comdat +// LINUX: define {{.*}}i32 @_Z10overloadedPKc.arch_ivybridge.0(ptr{{.+}}) +// LINUX: define {{.*}}i32 @_Z10overloadedPKc.default.1(ptr{{.+}}) +// LINUX: define weak_odr ptr @_Z10overloadedPKc.resolver() comdat +// LINUX: ret ptr @_Z10overloadedPKc.arch_ivybridge.0 +// LINUX: ret ptr @_Z10overloadedPKc.default.1 + +// WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHPEBD@Z.arch_ivybridge.0"(ptr{{.+}}) +// WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHPEBD@Z.default.1"(ptr{{.+}}) +// WINDOWS: define weak_odr dso_local i32 @"?overloaded@@YAHPEBD@Z"(ptr{{.+}}) comdat // WINDOWS: call i32 @"?overloaded@@YAHPEBD@Z.arch_ivybridge.0" // WINDOWS: call i32 @"?overloaded@@YAHPEBD@Z.default.1" @@ -64,57 +64,57 @@ void uses_specialized() { C c; c.foo(); - // LINUX: call noundef i32 @_ZN1CIssE3fooEv.ifunc(%struct.C - // WINDOWS: call noundef i32 @"?foo@?$C@FF@@QEAAHXZ"(%struct.C + // LINUX: call noundef i32 @_ZN1CIssE3fooEv.ifunc(ptr + // WINDOWS: call noundef i32 @"?foo@?$C@FF@@QEAAHXZ"(ptr C c2; c2.foo(); - // LINUX: call noundef i32 @_ZN1CIisE3fooEv.ifunc(%struct.C - // WINDOWS: call noundef i32 @"?foo@?$C@HF@@QEAAHXZ"(%struct.C + // LINUX: call noundef i32 @_ZN1CIisE3fooEv.ifunc(ptr + // WINDOWS: call noundef i32 @"?foo@?$C@HF@@QEAAHXZ"(ptr C c3; c3.foo(); // Note this is not an ifunc/mv - // LINUX: call noundef i32 @_ZN1CIfsE3fooEv(%struct.C - // WINDOWS: call noundef i32 @"?foo@?$C@MF@@QEAAHXZ"(%struct.C + // LINUX: call noundef i32 @_ZN1CIfsE3fooEv(ptr + // WINDOWS: call noundef i32 @"?foo@?$C@MF@@QEAAHXZ"(ptr C c4; c4.foo(); - // LINUX: call noundef i32 @_ZN1CIdfE3fooEv.ifunc(%struct.C - // WINDOWS: call noundef i32 @"?foo@?$C@NM@@QEAAHXZ"(%struct.C + // LINUX: call noundef i32 @_ZN1CIdfE3fooEv.ifunc(ptr + // WINDOWS: call noundef i32 @"?foo@?$C@NM@@QEAAHXZ"(ptr } -// LINUX: define weak_odr i32 (%struct.C*)* @_ZN1CIssE3fooEv.resolver() comdat -// LINUX: ret i32 (%struct.C*)* @_ZN1CIssE3fooEv.sse4.2.0 -// LINUX: ret i32 (%struct.C*)* @_ZN1CIssE3fooEv.default.1 +// LINUX: define weak_odr ptr @_ZN1CIssE3fooEv.resolver() comdat +// LINUX: ret ptr @_ZN1CIssE3fooEv.sse4.2.0 +// LINUX: ret ptr @_ZN1CIssE3fooEv.default.1 -// WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ"(%struct.C{{.+}}) +// WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ"(ptr // WINDOWS: call i32 @"?foo@?$C@FF@@QEAAHXZ.sse4.2.0" // WINDOWS: call i32 @"?foo@?$C@FF@@QEAAHXZ.default.1" -// LINUX: define weak_odr i32 (%struct.C{{.+}})* @_ZN1CIisE3fooEv.resolver() comdat -// LINUX: ret i32 (%struct.C{{.+}})* @_ZN1CIisE3fooEv.sse4.2.0 -// LINUX: ret i32 (%struct.C{{.+}})* @_ZN1CIisE3fooEv.default.1 +// LINUX: define weak_odr ptr @_ZN1CIisE3fooEv.resolver() comdat +// LINUX: ret ptr @_ZN1CIisE3fooEv.sse4.2.0 +// LINUX: ret ptr @_ZN1CIisE3fooEv.default.1 -// WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ"(%struct.C{{.+}}) +// WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ"(ptr // WINDOWS: call i32 @"?foo@?$C@HF@@QEAAHXZ.sse4.2.0" // WINDOWS: call i32 @"?foo@?$C@HF@@QEAAHXZ.default.1" -// LINUX: define weak_odr i32 (%struct.C{{.+}})* @_ZN1CIdfE3fooEv.resolver() comdat -// LINUX: ret i32 (%struct.C{{.+}})* @_ZN1CIdfE3fooEv.sse4.2.0 -// LINUX: ret i32 (%struct.C{{.+}})* @_ZN1CIdfE3fooEv.default.1 +// LINUX: define weak_odr ptr @_ZN1CIdfE3fooEv.resolver() comdat +// LINUX: ret ptr @_ZN1CIdfE3fooEv.sse4.2.0 +// LINUX: ret ptr @_ZN1CIdfE3fooEv.default.1 -// WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ"(%struct.C{{.+}}) +// WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ"(ptr // WINDOWS: call i32 @"?foo@?$C@NM@@QEAAHXZ.sse4.2.0" // WINDOWS: call i32 @"?foo@?$C@NM@@QEAAHXZ.default.1" -// LINUX: define {{.*}}i32 @_ZN1CIssE3fooEv.sse4.2.0(%struct.C{{.+}}) -// LINUX: define {{.*}}i32 @_ZN1CIssE3fooEv.default.1(%struct.C{{.+}}) -// LINUX: define {{.*}}i32 @_ZN1CIisE3fooEv.sse4.2.0(%struct.C{{.+}}) -// LINUX: define {{.*}}i32 @_ZN1CIisE3fooEv.default.1(%struct.C{{.+}}) -// LINUX: define {{.*}}i32 @_ZN1CIdfE3fooEv.sse4.2.0(%struct.C{{.+}}) -// LINUX: define {{.*}}i32 @_ZN1CIdfE3fooEv.default.1(%struct.C{{.+}}) - -// WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ.sse4.2.0"(%struct.C{{.+}}) -// WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ.default.1"(%struct.C{{.+}}) -// WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ.sse4.2.0"(%struct.C{{.+}}) -// WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ.default.1"(%struct.C{{.+}}) -// WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ.sse4.2.0"(%struct.C{{.+}}) -// WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ.default.1"(%struct.C{{.+}}) +// LINUX: define {{.*}}i32 @_ZN1CIssE3fooEv.sse4.2.0(ptr +// LINUX: define {{.*}}i32 @_ZN1CIssE3fooEv.default.1(ptr +// LINUX: define {{.*}}i32 @_ZN1CIisE3fooEv.sse4.2.0(ptr +// LINUX: define {{.*}}i32 @_ZN1CIisE3fooEv.default.1(ptr +// LINUX: define {{.*}}i32 @_ZN1CIdfE3fooEv.sse4.2.0(ptr +// LINUX: define {{.*}}i32 @_ZN1CIdfE3fooEv.default.1(ptr + +// WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ.sse4.2.0"(ptr +// WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ.default.1"(ptr +// WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ.sse4.2.0"(ptr +// WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ.default.1"(ptr +// WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ.sse4.2.0"(ptr +// WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ.default.1"(ptr