From 2eb84c3ae2bf6c918c20cbe1c315e2f4683056f4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Jun 2023 15:16:35 +0200 Subject: [PATCH] [Clang] Convert some tests to opaque pointers (NFC) --- clang/test/CodeGenObjC/mrr-autorelease.m | 12 +- clang/test/CodeGenObjC/noescape.m | 87 ++- .../CodeGenObjC/nontrivial-c-struct-exception.m | 27 +- clang/test/CodeGenObjC/ns_consume_null_check.m | 80 +- .../CodeGenObjC/nsvalue-objc-boxable-ios-arc.m | 70 +- clang/test/CodeGenObjC/nsvalue-objc-boxable-ios.m | 58 +- .../CodeGenObjC/nsvalue-objc-boxable-mac-arc.m | 63 +- clang/test/CodeGenObjC/nsvalue-objc-boxable-mac.m | 63 +- clang/test/CodeGenObjC/null-check-bool-ret.m | 4 +- .../CodeGenObjC/objc-arc-container-subscripting.m | 13 +- .../CodeGenObjC/objc-container-subscripting-1.m | 46 +- clang/test/CodeGenObjC/objc2-legacy-dispatch.m | 6 +- clang/test/CodeGenObjC/os_log.m | 141 ++-- clang/test/CodeGenObjC/parameterized_classes.m | 35 +- clang/test/CodeGenObjC/property-ref-cast-to-void.m | 8 +- clang/test/CodeGenObjC/property-type-mismatch.m | 8 +- clang/test/CodeGenObjC/property.m | 70 +- clang/test/CodeGenObjC/protocols.m | 20 +- clang/test/CodeGenObjC/stret-lifetime.m | 14 +- clang/test/CodeGenObjC/stret_lookup.m | 14 +- clang/test/CodeGenObjC/strong-in-c-struct.m | 829 +++++++++------------ clang/test/CodeGenObjC/ubsan-nonnull.m | 20 +- clang/test/CodeGenObjC/ubsan-nullability.m | 71 +- 23 files changed, 750 insertions(+), 1009 deletions(-) diff --git a/clang/test/CodeGenObjC/mrr-autorelease.m b/clang/test/CodeGenObjC/mrr-autorelease.m index 874354c..050c584 100644 --- a/clang/test/CodeGenObjC/mrr-autorelease.m +++ b/clang/test/CodeGenObjC/mrr-autorelease.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s // rdar://8881826 // rdar://9423507 @@ -18,7 +18,7 @@ } @end -// CHECK-NOT: call i8* @objc_getClass -// CHECK: call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK: call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK-NOT: call ptr @objc_getClass +// CHECK: call ptr @objc_msgSend +// CHECK: call ptr @objc_msgSend +// CHECK: call void @objc_msgSend diff --git a/clang/test/CodeGenObjC/noescape.m b/clang/test/CodeGenObjC/noescape.m index e83063b..3dfcff1 100644 --- a/clang/test/CodeGenObjC/noescape.m +++ b/clang/test/CodeGenObjC/noescape.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -fblocks -emit-llvm -o - %s | FileCheck -check-prefix CHECK -check-prefix CHECK-NOARC %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -fblocks -emit-llvm -fobjc-arc -o - %s | FileCheck -check-prefix CHECK -check-prefix CHECK-ARC %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -fblocks -emit-llvm -o - %s | FileCheck -check-prefix CHECK -check-prefix CHECK-NOARC %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -fblocks -emit-llvm -fobjc-arc -o - %s | FileCheck -check-prefix CHECK -check-prefix CHECK-ARC %s typedef void (^BlockTy)(void); @@ -17,19 +17,17 @@ void noescapeFunc3(__attribute__((noescape)) union U); // Block descriptors of non-escaping blocks don't need pointers to copy/dispose // helper functions. -// CHECK: %[[STRUCT_BLOCK_DESCRIPTOR:.*]] = type { i64, i64 } - // When the block is non-escaping, copy/dispose helpers aren't generated, so the // block layout string must include information about __strong captures. -// CHECK-NOARC: %[[STRUCT_BLOCK_BYREF_B0:.*]] = type { i8*, %[[STRUCT_BLOCK_BYREF_B0]]*, i32, i32, i8*, %[[STRUCT_S0:.*]] } -// CHECK-ARC: %[[STRUCT_BLOCK_BYREF_B0:.*]] = type { i8*, %[[STRUCT_BLOCK_BYREF_B0]]*, i32, i32, i8*, i8*, i8*, %[[STRUCT_S0:.*]] } -// CHECK: %[[STRUCT_S0]] = type { i8*, i8* } -// CHECK: @[[BLOCK_DESCIPTOR_TMP_2:.*ls32l8"]] = linkonce_odr hidden unnamed_addr constant { i64, i64, i8*, i64 } { i64 0, i64 40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @{{.*}}, i32 0, i32 0), i64 256 }, align 8 +// CHECK-NOARC: %[[STRUCT_BLOCK_BYREF_B0:.*]] = type { ptr, ptr, i32, i32, ptr, %[[STRUCT_S0:.*]] } +// CHECK-ARC: %[[STRUCT_BLOCK_BYREF_B0:.*]] = type { ptr, ptr, i32, i32, ptr, ptr, ptr, %[[STRUCT_S0:.*]] } +// CHECK: %[[STRUCT_S0]] = type { ptr, ptr } +// CHECK: @[[BLOCK_DESCIPTOR_TMP_2:.*ls32l8"]] = linkonce_odr hidden unnamed_addr constant { i64, i64, ptr, i64 } { i64 0, i64 40, ptr @{{.*}}, i64 256 }, align 8 // CHECK-LABEL: define{{.*}} void @test0( // CHECK: call void @noescapeFunc0({{.*}}, {{.*}} nocapture {{.*}}) -// CHECK: declare void @noescapeFunc0(i8* noundef, {{.*}} nocapture noundef) +// CHECK: declare void @noescapeFunc0(ptr noundef, {{.*}} nocapture noundef) void test0(BlockTy b) { noescapeFunc0(0, b); } @@ -58,7 +56,7 @@ void test3(union U u) { // CHECK: define internal void @"\01-[C0 m0:]"({{.*}}, {{.*}}, {{.*}} nocapture {{.*}}) // CHECK-LABEL: define{{.*}} void @test4( -// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32*)*)(i8* {{.*}}, i8* {{.*}}, i32* nocapture {{.*}}) +// CHECK: call void @objc_msgSend(ptr {{.*}}, ptr {{.*}}, ptr nocapture {{.*}}) @interface C0 -(void) m0:(int*)__attribute__((noescape)) p0; @@ -74,9 +72,9 @@ void test4(C0 *c0, int *p) { } // CHECK-LABEL: define{{.*}} void @test5( -// CHECK: call void {{.*}}(i8* noundef bitcast ({ i8**, i32, i32, i8*, {{.*}} }* @{{.*}} to i8*), i32* nocapture {{.*}}) -// CHECK: call void {{.*}}(i8* {{.*}}, i32* nocapture {{.*}}) -// CHECK: define internal void @{{.*}}(i8* {{.*}}, i32* nocapture {{.*}}) +// CHECK: call void {{.*}}(ptr noundef @{{.*}}, ptr nocapture {{.*}}) +// CHECK: call void {{.*}}(ptr {{.*}}, ptr nocapture {{.*}}) +// CHECK: define internal void @{{.*}}(ptr {{.*}}, ptr nocapture {{.*}}) typedef void (^BlockTy2)(__attribute__((noescape)) int *); @@ -88,28 +86,28 @@ void test5(BlockTy2 b, int *p) { // If the block is non-escaping, set the BLOCK_IS_NOESCAPE and BLOCK_IS_GLOBAL // bits of field 'flags' and set the 'isa' field to 'NSConcreteGlobalBlock'. -// CHECK: define{{.*}} void @test6(i8* noundef %{{.*}}, i8* noundef %[[B:.*]]) -// CHECK: %{{.*}} = alloca i8*, align 8 -// CHECK: %[[B_ADDR:.*]] = alloca i8*, align 8 -// CHECK: %[[BLOCK:.*]] = alloca <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, align 8 -// CHECK-NOARC: store i8* %[[B]], i8** %[[B_ADDR]], align 8 -// CHECK-ARC: store i8* null, i8** %[[B_ADDR]], align 8 -// CHECK-ARC: call void @llvm.objc.storeStrong(i8** %[[B_ADDR]], i8* %[[B]]) -// CHECK: %[[BLOCK_ISA:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>* %[[BLOCK]], i32 0, i32 0 -// CHECK: store i8* bitcast (i8** @_NSConcreteGlobalBlock to i8*), i8** %[[BLOCK_ISA]], align 8 -// CHECK: %[[BLOCK_FLAGS:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>* %[[BLOCK]], i32 0, i32 1 -// CHECK: store i32 -796917760, i32* %[[BLOCK_FLAGS]], align 8 -// CHECK: %[[BLOCK_DESCRIPTOR:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>* %[[BLOCK]], i32 0, i32 4 -// CHECK: store %[[STRUCT_BLOCK_DESCRIPTOR]]* bitcast ({ i64, i64, i8*, i64 }* @[[BLOCK_DESCIPTOR_TMP_2]] to %[[STRUCT_BLOCK_DESCRIPTOR]]*), %[[STRUCT_BLOCK_DESCRIPTOR]]** %[[BLOCK_DESCRIPTOR]], align 8 -// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>* %[[BLOCK]], i32 0, i32 5 -// CHECK-NOARC: %[[V1:.*]] = load i8*, i8** %[[B_ADDR]], align 8 -// CHECK-NOARC: store i8* %[[V1]], i8** %[[BLOCK_CAPTURED]], align 8 -// CHECK-ARC: %[[V2:.*]] = load i8*, i8** %[[B_ADDR]], align 8 -// CHECK-ARC: %[[V3:.*]] = call i8* @llvm.objc.retain(i8* %[[V2]]) -// CHECK-ARC: store i8* %[[V3]], i8** %[[BLOCK_CAPTURED]], align 8 +// CHECK: define{{.*}} void @test6(ptr noundef %{{.*}}, ptr noundef %[[B:.*]]) +// CHECK: %{{.*}} = alloca ptr, align 8 +// CHECK: %[[B_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[BLOCK:.*]] = alloca <{ ptr, i32, i32, ptr, ptr, ptr }>, align 8 +// CHECK-NOARC: store ptr %[[B]], ptr %[[B_ADDR]], align 8 +// CHECK-ARC: store ptr null, ptr %[[B_ADDR]], align 8 +// CHECK-ARC: call void @llvm.objc.storeStrong(ptr %[[B_ADDR]], ptr %[[B]]) +// CHECK: %[[BLOCK_ISA:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 0 +// CHECK: store ptr @_NSConcreteGlobalBlock, ptr %[[BLOCK_ISA]], align 8 +// CHECK: %[[BLOCK_FLAGS:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 1 +// CHECK: store i32 -796917760, ptr %[[BLOCK_FLAGS]], align 8 +// CHECK: %[[BLOCK_DESCRIPTOR:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 4 +// CHECK: store ptr @[[BLOCK_DESCIPTOR_TMP_2]], ptr %[[BLOCK_DESCRIPTOR]], align 8 +// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 5 +// CHECK-NOARC: %[[V1:.*]] = load ptr, ptr %[[B_ADDR]], align 8 +// CHECK-NOARC: store ptr %[[V1]], ptr %[[BLOCK_CAPTURED]], align 8 +// CHECK-ARC: %[[V2:.*]] = load ptr, ptr %[[B_ADDR]], align 8 +// CHECK-ARC: %[[V3:.*]] = call ptr @llvm.objc.retain(ptr %[[V2]]) +// CHECK-ARC: store ptr %[[V3]], ptr %[[BLOCK_CAPTURED]], align 8 // CHECK: call void @noescapeFunc0( -// CHECK-ARC: call void @llvm.objc.storeStrong(i8** %[[BLOCK_CAPTURED]], i8* null) -// CHECK-ARC: call void @llvm.objc.storeStrong(i8** %[[B_ADDR]], i8* null) +// CHECK-ARC: call void @llvm.objc.storeStrong(ptr %[[BLOCK_CAPTURED]], ptr null) +// CHECK-ARC: call void @llvm.objc.storeStrong(ptr %[[B_ADDR]], ptr null) // Non-escaping blocks don't need copy/dispose helper functions. @@ -126,11 +124,11 @@ void test6(id a, id b) { // __block variables that are not captured by escaping blocks. // CHECK: define{{.*}} void @test7( -// CHECK: alloca i8*, align 8 -// CHECK: %[[B0:.*]] = alloca i8*, align 8 -// CHECK: %[[BLOCK:.*]] = alloca <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8** }>, align 8 -// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8** }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8** }>* %[[BLOCK]], i32 0, i32 5 -// CHECK: store i8** %[[B0]], i8*** %[[BLOCK_CAPTURED]], align 8 +// CHECK: alloca ptr, align 8 +// CHECK: %[[B0:.*]] = alloca ptr, align 8 +// CHECK: %[[BLOCK:.*]] = alloca <{ ptr, i32, i32, ptr, ptr, ptr }>, align 8 +// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 5 +// CHECK: store ptr %[[B0]], ptr %[[BLOCK_CAPTURED]], align 8 // CHECK-ARC-NOT: define internal void @__Block_byref_object_copy_ // CHECK-ARC-NOT: define internal void @__Block_byref_object_dispose_ @@ -144,13 +142,12 @@ void test7(void) { // __block variables captured by escaping blocks need byref helper functions. // CHECK: define{{.*}} void @test8( -// CHECK: %[[A:.*]] = alloca i8*, align 8 +// CHECK: %[[A:.*]] = alloca ptr, align 8 // CHECK: %[[B0:.*]] = alloca %[[STRUCT_BLOCK_BYREF_B0]], align 8 -// CHECK: alloca <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, align 8 -// CHECK: %[[BLOCK1:.*]] = alloca <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, align 8 -// CHECK: %[[BLOCK_CAPTURED7:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8* }>* %[[BLOCK1]], i32 0, i32 5 -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_BLOCK_BYREF_B0]]* %[[B0]] to i8* -// CHECK: store i8* %[[V3]], i8** %[[BLOCK_CAPTURED7]], align 8 +// CHECK: alloca <{ ptr, i32, i32, ptr, ptr, ptr }>, align 8 +// CHECK: %[[BLOCK1:.*]] = alloca <{ ptr, i32, i32, ptr, ptr, ptr }>, align 8 +// CHECK: %[[BLOCK_CAPTURED7:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr }>, ptr %[[BLOCK1]], i32 0, i32 5 +// CHECK: store ptr %[[B0]], ptr %[[BLOCK_CAPTURED7]], align 8 // CHECK-ARC: define internal void @__Block_byref_object_copy_ // CHECK-ARC: define internal void @__Block_byref_object_dispose_ diff --git a/clang/test/CodeGenObjC/nontrivial-c-struct-exception.m b/clang/test/CodeGenObjC/nontrivial-c-struct-exception.m index 38d6ed1..0159e11 100644 --- a/clang/test/CodeGenObjC/nontrivial-c-struct-exception.m +++ b/clang/test/CodeGenObjC/nontrivial-c-struct-exception.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -fobjc-exceptions -fexceptions -debug-info-kind=line-tables-only -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -fobjc-exceptions -fexceptions -debug-info-kind=line-tables-only -emit-llvm -o - %s | FileCheck %s -// CHECK: %[[STRUCT_STRONG:.*]] = type { i32, i8* } -// CHECK: %[[STRUCT_WEAK:.*]] = type { i32, i8* } +// CHECK: %[[STRUCT_STRONG:.*]] = type { i32, ptr } +// CHECK: %[[STRUCT_WEAK:.*]] = type { i32, ptr } typedef struct { int i; @@ -17,16 +17,14 @@ typedef struct { // CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_STRONG]], align 8 // CHECK: %[[AGG_TMP1:.*]] = alloca %[[STRUCT_STRONG]], align 8 // CHECK: %[[CALL:.*]] = call [2 x i64] @genStrong() -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONG]]* %[[AGG_TMP]] to [2 x i64]* -// CHECK: store [2 x i64] %[[CALL]], [2 x i64]* %[[V0]], align 8 +// CHECK: store [2 x i64] %[[CALL]], ptr %[[AGG_TMP]], align 8 // CHECK: invoke [2 x i64] @genStrong() // CHECK: call void @calleeStrong([2 x i64] %{{.*}}, [2 x i64] %{{.*}}) // CHECK-NEXT: ret void -// CHECK: landingpad { i8*, i32 } -// CHECK: %[[V9:.*]] = bitcast %[[STRUCT_STRONG]]* %[[AGG_TMP]] to i8**{{.*}}, !dbg [[ARTIFICIAL_LOC_1:![0-9]+]] -// CHECK: call void @__destructor_8_s8(i8** %[[V9]]){{.*}}, !dbg [[ARTIFICIAL_LOC_1]] +// CHECK: landingpad { ptr, i32 } +// CHECK: call void @__destructor_8_s8(ptr %[[AGG_TMP]]){{.*}}, !dbg [[ARTIFICIAL_LOC_1:![0-9]+]] // CHECK: br label // CHECK: resume @@ -41,21 +39,20 @@ void testStrongException(void) { // CHECK: define{{.*}} void @testWeakException() // CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_WEAK]], align 8 // CHECK: %[[AGG_TMP1:.*]] = alloca %[[STRUCT_WEAK]], align 8 -// CHECK: call void @genWeak(%[[STRUCT_WEAK]]* sret(%[[STRUCT_WEAK]]) align 8 %[[AGG_TMP]]) -// CHECK: invoke void @genWeak(%[[STRUCT_WEAK]]* sret(%[[STRUCT_WEAK]]) align 8 %[[AGG_TMP1]]) +// CHECK: call void @genWeak(ptr sret(%[[STRUCT_WEAK]]) align 8 %[[AGG_TMP]]) +// CHECK: invoke void @genWeak(ptr sret(%[[STRUCT_WEAK]]) align 8 %[[AGG_TMP1]]) -// CHECK: call void @calleeWeak(%[[STRUCT_WEAK]]* noundef %[[AGG_TMP]], %[[STRUCT_WEAK]]* noundef %[[AGG_TMP1]]) +// CHECK: call void @calleeWeak(ptr noundef %[[AGG_TMP]], ptr noundef %[[AGG_TMP1]]) // CHECK: ret void -// CHECK: landingpad { i8*, i32 } -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_WEAK]]* %[[AGG_TMP]] to i8**{{.*}}, !dbg [[ARTIFICIAL_LOC_2:![0-9]+]] -// CHECK: call void @__destructor_8_w8(i8** %[[V3]]){{.*}}, !dbg [[ARTIFICIAL_LOC_2]] +// CHECK: landingpad { ptr, i32 } +// CHECK: call void @__destructor_8_w8(ptr %[[AGG_TMP]]){{.*}}, !dbg [[ARTIFICIAL_LOC_2:![0-9]+]] // CHECK: br label // CHECK: resume // CHECK: define{{.*}} void @__destructor_8_w8({{.*}} !dbg ![[DTOR_SP:.*]] { -// CHECK: load i8**, i8*** {{.*}}, !dbg ![[DTOR_LOC:.*]] +// CHECK: load ptr, ptr {{.*}}, !dbg ![[DTOR_LOC:.*]] Weak genWeak(void); void calleeWeak(Weak, Weak); diff --git a/clang/test/CodeGenObjC/ns_consume_null_check.m b/clang/test/CodeGenObjC/ns_consume_null_check.m index 05e1db4..6213f0a 100644 --- a/clang/test/CodeGenObjC/ns_consume_null_check.m +++ b/clang/test/CodeGenObjC/ns_consume_null_check.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-dispatch-method=mixed -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-dispatch-method=mixed -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -o - %s | FileCheck %s @interface NSObject - (id) new; @@ -18,15 +18,13 @@ void test0(void) { [x isEqual : obj]; } // CHECK-LABEL: define{{.*}} void @test0() -// CHECK: [[FIVE:%.*]] = call i8* @llvm.objc.retain -// CHECK-NEXT: [[SIX:%.*]] = bitcast -// CHECK-NEXT: [[SEVEN:%.*]] = icmp eq i8* [[SIX]], null +// CHECK: [[FIVE:%.*]] = call ptr @llvm.objc.retain +// CHECK-NEXT: [[SEVEN:%.*]] = icmp eq ptr {{.*}}, null // CHECK-NEXT: br i1 [[SEVEN]], label [[NULLINIT:%.*]], label [[CALL_LABEL:%.*]] -// CHECK: [[FN:%.*]] = load i8*, i8** getelementptr inbounds -// CHECK-NEXT: [[EIGHT:%.*]] = bitcast i8* [[FN]] -// CHECK-NEXT: [[CALL:%.*]] = call signext i8 [[EIGHT]] +// CHECK: [[FN:%.*]] = load ptr, ptr +// CHECK-NEXT: [[CALL:%.*]] = call signext i8 [[FN]] // CHECK-NEXT: br label [[CONT:%.*]] -// CHECK: call void @llvm.objc.release(i8* [[FIVE]]) [[NUW:#[0-9]+]] +// CHECK: call void @llvm.objc.release(ptr [[FIVE]]) [[NUW:#[0-9]+]] // CHECK-NEXT: br label [[CONT]] // CHECK: phi i8 [ [[CALL]], {{%.*}} ], [ 0, {{%.*}} ] @@ -38,61 +36,59 @@ void test1(void) { _Complex float result = [x asComplexWithArg: obj]; } // CHECK-LABEL: define{{.*}} void @test1() -// CHECK: [[OBJ:%.*]] = alloca i8*, align 8 -// CHECK-NEXT: [[WEAKOBJ:%.*]] = alloca i8*, align 8 +// CHECK: [[OBJ:%.*]] = alloca ptr, align 8 +// CHECK-NEXT: [[WEAKOBJ:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[RESULT:%.*]] = alloca { float, float }, align 4 // Various initializations. -// CHECK: [[T0:%.*]] = call i8* bitcast ( -// CHECK-NEXT: store i8* [[T0]], i8** [[OBJ]] -// CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[OBJ]] -// CHECK-NEXT: call i8* @llvm.objc.initWeak(i8** [[WEAKOBJ]], i8* [[T0]]) [[NUW]] +// CHECK: [[T0:%.*]] = call ptr +// CHECK-NEXT: store ptr [[T0]], ptr [[OBJ]] +// CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[OBJ]] +// CHECK-NEXT: call ptr @llvm.objc.initWeak(ptr [[WEAKOBJ]], ptr [[T0]]) [[NUW]] // Okay, start the message-send. -// CHECK-NEXT: [[T0:%.*]] = load [[MYOBJECT:%.*]]*, [[MYOBJECT:%.*]]** @x -// CHECK-NEXT: [[ARG:%.*]] = load i8*, i8** [[OBJ]] -// CHECK-NEXT: [[ARG_RETAINED:%.*]] = call i8* @llvm.objc.retain(i8* [[ARG]]) -// CHECK-NEXT: [[SELF:%.*]] = bitcast [[MYOBJECT]]* [[T0]] to i8* +// CHECK-NEXT: [[T0:%.*]] = load ptr, ptr @x +// CHECK-NEXT: [[ARG:%.*]] = load ptr, ptr [[OBJ]] +// CHECK-NEXT: [[ARG_RETAINED:%.*]] = call ptr @llvm.objc.retain(ptr [[ARG]]) // Null check. -// CHECK-NEXT: [[T0:%.*]] = icmp eq i8* [[SELF]], null -// CHECK-NEXT: br i1 [[T0]], label [[FORNULL:%.*]], label %[[FORCALL:.*]] +// CHECK-NEXT: [[T1:%.*]] = icmp eq ptr [[T0]], null +// CHECK-NEXT: br i1 [[T1]], label [[FORNULL:%.*]], label %[[FORCALL:.*]] // Invoke and produce the return values. // CHECK: [[FORCALL]]: -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES_ -// CHECK-NEXT: [[CALL:%.*]] = invoke <2 x float> bitcast +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES_ +// CHECK-NEXT: [[CALL:%.*]] = invoke <2 x float> // CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label {{%.*}} -// CHECK: [[T0:%.*]] = bitcast { float, float }* [[COERCE:%.*]] to <2 x float>* -// CHECK-NEXT: store <2 x float> [[CALL]], <2 x float>* [[T0]], -// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { float, float }, { float, float }* [[COERCE]], i32 0, i32 0 -// CHECK-NEXT: [[REALCALL:%.*]] = load float, float* [[T0]] -// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { float, float }, { float, float }* [[COERCE]], i32 0, i32 1 -// CHECK-NEXT: [[IMAGCALL:%.*]] = load float, float* [[T0]] +// CHECK: store <2 x float> [[CALL]], ptr [[COERCE:%.*]], +// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { float, float }, ptr [[COERCE]], i32 0, i32 0 +// CHECK-NEXT: [[REALCALL:%.*]] = load float, ptr [[T0]] +// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { float, float }, ptr [[COERCE]], i32 0, i32 1 +// CHECK-NEXT: [[IMAGCALL:%.*]] = load float, ptr [[T0]] // CHECK-NEXT: br label [[CONT:%.*]]{{$}} // Null path. -// CHECK: call void @llvm.objc.release(i8* [[ARG_RETAINED]]) [[NUW]] +// CHECK: call void @llvm.objc.release(ptr [[ARG_RETAINED]]) [[NUW]] // CHECK-NEXT: br label [[CONT]] // Join point. // CHECK: [[REAL:%.*]] = phi float [ [[REALCALL]], [[INVOKE_CONT]] ], [ 0.000000e+00, [[FORNULL]] ] // CHECK-NEXT: [[IMAG:%.*]] = phi float [ [[IMAGCALL]], [[INVOKE_CONT]] ], [ 0.000000e+00, [[FORNULL]] ] -// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { float, float }, { float, float }* [[RESULT]], i32 0, i32 0 -// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds { float, float }, { float, float }* [[RESULT]], i32 0, i32 1 -// CHECK-NEXT: store float [[REAL]], float* [[T0]] -// CHECK-NEXT: store float [[IMAG]], float* [[T1]] +// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { float, float }, ptr [[RESULT]], i32 0, i32 0 +// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds { float, float }, ptr [[RESULT]], i32 0, i32 1 +// CHECK-NEXT: store float [[REAL]], ptr [[T0]] +// CHECK-NEXT: store float [[IMAG]], ptr [[T1]] // Epilogue. -// CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[WEAKOBJ]]) [[NUW]] -// CHECK-NEXT: call void @llvm.objc.storeStrong(i8** [[OBJ]], i8* null) [[NUW]] +// CHECK-NEXT: call void @llvm.objc.destroyWeak(ptr [[WEAKOBJ]]) [[NUW]] +// CHECK-NEXT: call void @llvm.objc.storeStrong(ptr [[OBJ]], ptr null) [[NUW]] // CHECK-NEXT: ret void // Cleanup. // CHECK: landingpad -// CHECK: call void @llvm.objc.destroyWeak(i8** [[WEAKOBJ]]) [[NUW]] +// CHECK: call void @llvm.objc.destroyWeak(ptr [[WEAKOBJ]]) [[NUW]] void test2(id a) { id obj = [MyObject m0:a]; } // CHECK-LABEL: define{{.*}} void @test2( -// CHECK: %[[CALL:.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK-NEXT: %[[V6:.*]] = {{.*}}call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[CALL]]) +// CHECK: %[[CALL:.*]] = call ptr @objc_msgSend +// CHECK-NEXT: %[[V6:.*]] = {{.*}}call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[CALL]]) -// CHECK: phi i8* [ %[[V6]], %{{.*}} ], [ null, %{{.*}} ] +// CHECK: phi ptr [ %[[V6]], %{{.*}} ], [ null, %{{.*}} ] void test3(id a) { @try { @@ -102,9 +98,9 @@ void test3(id a) { } // CHECK-LABEL: define{{.*}} void @test3( -// CHECK: %[[CALL:.*]] = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK: %[[V6:.*]] = {{.*}}call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[CALL]]) +// CHECK: %[[CALL:.*]] = invoke ptr @objc_msgSend +// CHECK: %[[V6:.*]] = {{.*}}call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[CALL]]) -// CHECK: phi i8* [ %[[V6]], %{{.*}} ], [ null, %{{.*}} ] +// CHECK: phi ptr [ %[[V6]], %{{.*}} ], [ null, %{{.*}} ] // CHECK: attributes [[NUW]] = { nounwind } diff --git a/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m b/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m index 43c6894..ffaf460 100644 --- a/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m +++ b/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" @@ -17,15 +17,11 @@ void doRange(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSRange* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSRange ns_range = { .location = 0, .length = 42 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* {{.*}}[[RANGE_STR]]{{.*}}) - // CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr {{.*}}[[RANGE_STR]]{{.*}}) + // CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue NSValue *range = @(ns_range); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -36,15 +32,11 @@ void doPoint(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.CGPoint{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.CGPoint{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.CGPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.CGPoint* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.CGPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] CGPoint cg_point = { .x = 42, .y = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* {{.*}}[[POINT_STR]]{{.*}}) - // CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr {{.*}}[[POINT_STR]]{{.*}}) + // CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue NSValue *point = @(cg_point); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -55,15 +47,11 @@ void doSize(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.CGSize{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.CGSize{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.CGSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.CGSize* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.CGSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] CGSize cg_size = { .width = 42, .height = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* {{.*}}[[SIZE_STR]]{{.*}}) - // CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr {{.*}}[[SIZE_STR]]{{.*}}) + // CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue NSValue *size = @(cg_size); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -74,17 +62,13 @@ void doRect(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.CGRect{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.CGRect{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.CGRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.CGRect* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.CGRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] CGPoint cg_point = { .x = 42, .y = 24 }; CGSize cg_size = { .width = 42, .height = 24 }; CGRect cg_rect = { .origin = cg_point, .size = cg_size }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[RECT_STR]]{{.*}}) - // CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[RECT_STR]]{{.*}}) + // CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue NSValue *rect = @(cg_rect); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -95,15 +79,11 @@ void doNSEdgeInsets(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSEdgeInsets ns_edge_insets; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[EDGE_STR]]{{.*}}) - // CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[EDGE_STR]]{{.*}}) + // CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue NSValue *edge_insets = @(ns_edge_insets); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -114,11 +94,9 @@ void doRangeRValue(void) { // CHECK: [[COERCE:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] // CHECK: call {{.*}} @getRange({{.*}} [[COERCE]]) - // CHECK: [[COERCE_CAST:%.*]] = bitcast %struct._NSRange* [[COERCE]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[COERCE_CAST]], i8* {{.*}}[[RANGE_STR]]{{.*}}) - // CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[COERCE]], ptr {{.*}}[[RANGE_STR]]{{.*}}) + // CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue NSValue *range_rvalue = @(getRange()); // CHECK: call void @llvm.objc.release // CHECK: ret void diff --git a/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios.m b/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios.m index ff3dac2..2e01838 100644 --- a/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios.m +++ b/clang/test/CodeGenObjC/nsvalue-objc-boxable-ios.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" @@ -17,14 +17,10 @@ void doRange(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSRange* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSRange ns_range = { .location = 0, .length = 42 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* noundef {{.*}}[[RANGE_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr noundef {{.*}}[[RANGE_STR]]{{.*}}) NSValue *range = @(ns_range); // CHECK: ret void } @@ -34,14 +30,10 @@ void doPoint(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.CGPoint{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.CGPoint{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.CGPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.CGPoint* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.CGPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] CGPoint cg_point = { .x = 42, .y = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* noundef {{.*}}[[POINT_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr noundef {{.*}}[[POINT_STR]]{{.*}}) NSValue *point = @(cg_point); // CHECK: ret void } @@ -51,14 +43,10 @@ void doSize(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.CGSize{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.CGSize{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.CGSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.CGSize* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.CGSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] CGSize cg_size = { .width = 42, .height = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* noundef {{.*}}[[SIZE_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr noundef {{.*}}[[SIZE_STR]]{{.*}}) NSValue *size = @(cg_size); // CHECK: ret void } @@ -68,16 +56,12 @@ void doRect(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.CGRect{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.CGRect{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.CGRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.CGRect* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.CGRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] CGPoint cg_point = { .x = 42, .y = 24 }; CGSize cg_size = { .width = 42, .height = 24 }; CGRect cg_rect = { .origin = cg_point, .size = cg_size }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[RECT_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[RECT_STR]]{{.*}}) NSValue *rect = @(cg_rect); // CHECK: ret void } @@ -87,14 +71,10 @@ void doNSEdgeInsets(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSEdgeInsets ns_edge_insets; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[EDGE_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[EDGE_STR]]{{.*}}) NSValue *edge_insets = @(ns_edge_insets); // CHECK: ret void } @@ -104,10 +84,8 @@ void doRangeRValue(void) { // CHECK: [[COERCE:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] // CHECK: call {{.*}} @getRange({{.*}} [[COERCE]]) - // CHECK: [[COERCE_CAST:%.*]] = bitcast %struct._NSRange* [[COERCE]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[COERCE_CAST]], i8* noundef {{.*}}[[RANGE_STR]]{{.*}}) + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[COERCE]], ptr noundef {{.*}}[[RANGE_STR]]{{.*}}) NSValue *range_rvalue = @(getRange()); // CHECK: ret void } diff --git a/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m b/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m index 6ff4f9f..3085594 100644 --- a/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m +++ b/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" @@ -17,14 +17,10 @@ void doRange(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSRange* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSRange ns_range = { .location = 0, .length = 42 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* {{.*}}[[RANGE_STR]]{{.*}}) [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr {{.*}}[[RANGE_STR]]{{.*}}) [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] NSValue *range = @(ns_range); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -35,14 +31,10 @@ void doPoint(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSPoint{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSPoint{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSPoint* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSPoint ns_point = { .x = 42, .y = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* {{.*}}[[POINT_STR]]{{.*}}) [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr {{.*}}[[POINT_STR]]{{.*}}) [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] NSValue *point = @(ns_point); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -53,14 +45,10 @@ void doSize(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSSize{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSSize{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSSize* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSSize ns_size = { .width = 42, .height = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* {{.*}}[[SIZE_STR]]{{.*}}) [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr {{.*}}[[SIZE_STR]]{{.*}}) [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] NSValue *size = @(ns_size); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -71,16 +59,12 @@ void doRect(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSRect{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSRect{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSRect* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSPoint ns_point = { .x = 42, .y = 24 }; NSSize ns_size = { .width = 42, .height = 24 }; NSRect ns_rect = { .origin = ns_point, .size = ns_size }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[RECT_STR]]{{.*}}) [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[RECT_STR]]{{.*}}) [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] NSValue *rect = @(ns_rect); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -91,14 +75,10 @@ void doNSEdgeInsets(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSEdgeInsets ns_edge_insets; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[EDGE_STR]]{{.*}}) [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[EDGE_STR]]{{.*}}) [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] NSValue *edge_insets = @(ns_edge_insets); // CHECK: call void @llvm.objc.release // CHECK: ret void @@ -109,14 +89,11 @@ void doRangeRValue(void) { // CHECK: [[COERCE:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] // CHECK: [[RVAL:%.*]] = call {{.*}} @getRange() - // CHECK: [[COERCE_CAST:%.*]] = bitcast %struct._NSRange* [[COERCE]]{{.*}} - // CHECK: [[COERCE_CAST_PTR:%.*]] = getelementptr {{.*}} [[COERCE_CAST]], {{.*}} + // CHECK: [[COERCE_VAR_PTR:%.*]] = getelementptr {{.*}} [[COERCE]], {{.*}} // CHECK: [[EXTR_RVAL:%.*]] = extractvalue {{.*}} [[RVAL]]{{.*}} - // CHECK: store {{.*}}[[EXTR_RVAL]]{{.*}}[[COERCE_CAST_PTR]]{{.*}} - // CHECK: [[COERCE_CAST:%.*]] = bitcast %struct._NSRange* [[COERCE]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[COERCE_CAST]], i8* {{.*}}[[RANGE_STR]]{{.*}}) [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] + // CHECK: store {{.*}}[[EXTR_RVAL]]{{.*}}[[COERCE_VAR_PTR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[COERCE]], ptr {{.*}}[[RANGE_STR]]{{.*}}) [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] NSValue *range_rvalue = @(getRange()); // CHECK: call void @llvm.objc.release // CHECK: ret void diff --git a/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac.m b/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac.m index 3a03ef8..ce0e153 100644 --- a/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac.m +++ b/clang/test/CodeGenObjC/nsvalue-objc-boxable-mac.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" @@ -17,14 +17,10 @@ void doRange(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSRange* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSRange* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSRange ns_range = { .location = 0, .length = 42 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* noundef {{.*}}[[RANGE_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr noundef {{.*}}[[RANGE_STR]]{{.*}}) NSValue *range = @(ns_range); // CHECK: ret void } @@ -34,14 +30,10 @@ void doPoint(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSPoint{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSPoint{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSPoint* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSPoint* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSPoint ns_point = { .x = 42, .y = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* noundef {{.*}}[[POINT_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr noundef {{.*}}[[POINT_STR]]{{.*}}) NSValue *point = @(ns_point); // CHECK: ret void } @@ -51,14 +43,10 @@ void doSize(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSSize{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSSize{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSSize* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSSize* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSSize ns_size = { .width = 42, .height = 24 }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8* noundef {{.*}}[[SIZE_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr noundef {{.*}}[[SIZE_STR]]{{.*}}) NSValue *size = @(ns_size); // CHECK: ret void } @@ -68,16 +56,12 @@ void doRect(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct._NSRect{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct._NSRect{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct._NSRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct._NSRect* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct._NSRect* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSPoint ns_point = { .x = 42, .y = 24 }; NSSize ns_size = { .width = 42, .height = 24 }; NSRect ns_rect = { .origin = ns_point, .size = ns_size }; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[RECT_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[RECT_STR]]{{.*}}) NSValue *rect = @(ns_rect); // CHECK: ret void } @@ -87,14 +71,10 @@ void doNSEdgeInsets(void) { // CHECK: [[LOCAL_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[TEMP_VAR:%.*]] = alloca %struct.NSEdgeInsets{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] - // CHECK: [[TEMP_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[LOCAL_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[LOCAL_VAR]]{{.*}} - // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_CAST]]{{.*}} [[LOCAL_CAST]]{{.*}} - // CHECK: [[PARAM_CAST:%.*]] = bitcast %struct.NSEdgeInsets* [[TEMP_VAR]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] + // CHECK: call void @llvm.memcpy{{.*}} [[TEMP_VAR]]{{.*}} [[LOCAL_VAR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] NSEdgeInsets ns_edge_insets; - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[PARAM_CAST]], i8*{{.*}}[[EDGE_STR]]{{.*}}) + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[TEMP_VAR]], ptr{{.*}}[[EDGE_STR]]{{.*}}) NSValue *edge_insets = @(ns_edge_insets); // CHECK: ret void } @@ -104,14 +84,11 @@ void doRangeRValue(void) { // CHECK: [[COERCE:%.*]] = alloca %struct._NSRange{{.*}} // CHECK: [[RECV_PTR:%.*]] = load {{.*}} [[NSVALUE]] // CHECK: [[RVAL:%.*]] = call {{.*}} @getRange() - // CHECK: [[COERCE_CAST:%.*]] = bitcast %struct._NSRange* [[COERCE]]{{.*}} - // CHECK: [[COERCE_CAST_PTR:%.*]] = getelementptr {{.*}} [[COERCE_CAST]], {{.*}} + // CHECK: [[COERCE_VAR_PTR:%.*]] = getelementptr {{.*}} [[COERCE]], {{.*}} // CHECK: [[EXTR_RVAL:%.*]] = extractvalue {{.*}} [[RVAL]]{{.*}} - // CHECK: store {{.*}}[[EXTR_RVAL]]{{.*}}[[COERCE_CAST_PTR]]{{.*}} - // CHECK: [[COERCE_CAST:%.*]] = bitcast %struct._NSRange* [[COERCE]]{{.*}} - // CHECK: [[RECV:%.*]] = bitcast %struct._class_t* [[RECV_PTR]] to i8* - // CHECK: [[SEL:%.*]] = load i8*, i8** [[VALUE_SEL]] - // CHECK: call {{.*objc_msgSend.*}}(i8* noundef [[RECV]], i8* noundef [[SEL]], i8* noundef [[COERCE_CAST]], i8* noundef {{.*}}[[RANGE_STR]]{{.*}}) + // CHECK: store {{.*}}[[EXTR_RVAL]]{{.*}}[[COERCE_VAR_PTR]]{{.*}} + // CHECK: [[SEL:%.*]] = load ptr, ptr [[VALUE_SEL]] + // CHECK: call {{.*objc_msgSend.*}}(ptr noundef [[RECV_PTR]], ptr noundef [[SEL]], ptr noundef [[COERCE]], ptr noundef {{.*}}[[RANGE_STR]]{{.*}}) NSValue *range_rvalue = @(getRange()); // CHECK: ret void } diff --git a/clang/test/CodeGenObjC/null-check-bool-ret.m b/clang/test/CodeGenObjC/null-check-bool-ret.m index 3e0a124..0e22ddc 100644 --- a/clang/test/CodeGenObjC/null-check-bool-ret.m +++ b/clang/test/CodeGenObjC/null-check-bool-ret.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64e-apple-ios15.0.0 -emit-llvm-bc -fobjc-arc -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple arm64e-apple-ios15.0.0 -emit-llvm-bc -fobjc-arc -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s // rdar://73361264 @@ -28,7 +28,7 @@ typedef struct { @end // CHECK-LABEL: msgSend.call: -// CHECK: [[CALL:%[^ ]+]] = call i1 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to +// CHECK: [[CALL:%[^ ]+]] = call i1 @objc_msgSend // CHECK-NEXT: br label %msgSend.cont // CHECK-LABEL: msgSend.null-receiver: diff --git a/clang/test/CodeGenObjC/objc-arc-container-subscripting.m b/clang/test/CodeGenObjC/objc-arc-container-subscripting.m index bb46ea1..2f8f3f6 100644 --- a/clang/test/CodeGenObjC/objc-arc-container-subscripting.m +++ b/clang/test/CodeGenObjC/objc-arc-container-subscripting.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -fobjc-arc -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-arc -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s @interface NSMutableArray - (id)objectAtIndexedSubscript:(int)index; @@ -11,11 +11,10 @@ id func(void) { return array[3]; } -// CHECK: [[call:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK: [[SIX:%.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* [[call]]) [[NUW:#[0-9]+]] -// CHECK: [[ARRAY_CASTED:%.*]] = bitcast %0** {{%.*}} to i8** -// CHECK: call void @llvm.objc.storeStrong(i8** [[ARRAY_CASTED]], i8* null) -// CHECK: [[EIGHT:%.*]] = tail call i8* @llvm.objc.autoreleaseReturnValue(i8* [[SIX]]) [[NUW]] -// CHECK: ret i8* [[EIGHT]] +// CHECK: [[call:%.*]] = call ptr @objc_msgSend +// CHECK: [[SIX:%.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr [[call]]) [[NUW:#[0-9]+]] +// CHECK: call void @llvm.objc.storeStrong(ptr {{%.*}}, ptr null) +// CHECK: [[EIGHT:%.*]] = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr [[SIX]]) [[NUW]] +// CHECK: ret ptr [[EIGHT]] // CHECK: attributes [[NUW]] = { nounwind } diff --git a/clang/test/CodeGenObjC/objc-container-subscripting-1.m b/clang/test/CodeGenObjC/objc-container-subscripting-1.m index 0853c67..de8b3b5 100644 --- a/clang/test/CodeGenObjC/objc-container-subscripting-1.m +++ b/clang/test/CodeGenObjC/objc-container-subscripting-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s typedef unsigned int size_t; @protocol P @end @@ -18,39 +18,35 @@ int main(void) { id val; id oldObject = array[10]; -// CHECK: [[ARR:%.*]] = load {{%.*}} [[array:%.*]], align 8 -// CHECK-NEXT: [[ARRC:%.*]] = bitcast {{%.*}} [[ARR]] to i8* -// CHECK-NEXT: [[SEL:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_ -// CHECK-NEXT: [[CALL:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* noundef [[ARRC]], i8* noundef [[SEL]], i32 noundef 10) -// CHECK-NEXT: store i8* [[CALL]], i8** [[OLDOBJ:%.*]], align 8 +// CHECK: [[ARR:%.*]] = load {{.*}} [[array:%.*]], align 8 +// CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_ +// CHECK-NEXT: [[CALL:%.*]] = call ptr @objc_msgSend(ptr noundef [[ARR]], ptr noundef [[SEL]], i32 noundef 10) +// CHECK-NEXT: store ptr [[CALL]], ptr [[OLDOBJ:%.*]], align 8 val = (array[10] = oldObject); -// CHECK: [[FOUR:%.*]] = load i8*, i8** [[oldObject:%.*]], align 8 -// CHECK-NEXT: [[THREE:%.*]] = load {{%.*}} [[array:%.*]], align 8 -// CHECK-NEXT: [[SIX:%.*]] = bitcast {{%.*}} [[THREE]] to i8* -// CHECK-NEXT: [[FIVE:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.2 -// CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i32)*)(i8* noundef [[SIX]], i8* noundef [[FIVE]], i8* noundef [[FOUR]], i32 noundef 10) -// CHECK-NEXT: store i8* [[FOUR]], i8** [[val:%.*]] +// CHECK: [[FOUR:%.*]] = load ptr, ptr [[oldObject:%.*]], align 8 +// CHECK-NEXT: [[THREE:%.*]] = load {{.*}} [[array:%.*]], align 8 +// CHECK-NEXT: [[FIVE:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.2 +// CHECK-NEXT: call void @objc_msgSend(ptr noundef [[THREE]], ptr noundef [[FIVE]], ptr noundef [[FOUR]], i32 noundef 10) +// CHECK-NEXT: store ptr [[FOUR]], ptr [[val:%.*]] NSMutableDictionary *dictionary; id key; id newObject; oldObject = dictionary[key]; -// CHECK: [[SEVEN:%.*]] = load {{%.*}} [[DICTIONARY:%.*]], align 8 -// CHECK-NEXT: [[EIGHT:%.*]] = load i8*, i8** [[KEY:%.*]], align 8 -// CHECK-NEXT: [[ELEVEN:%.*]] = bitcast {{%.*}} [[SEVEN]] to i8* -// CHECK-NEXT: [[TEN:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.4 -// CHECK-NEXT: [[CALL1:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* noundef [[ELEVEN]], i8* noundef [[TEN]], i8* noundef [[EIGHT]]) -// CHECK-NEXT: store i8* [[CALL1]], i8** [[oldObject:%.*]], align 8 +// CHECK: [[SEVEN:%.*]] = load {{.*}} [[DICTIONARY:%.*]], align 8 +// CHECK-NEXT: [[EIGHT:%.*]] = load ptr, ptr [[KEY:%.*]], align 8 +// CHECK-NEXT: [[TEN:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.4 +// CHECK-NEXT: [[CALL1:%.*]] = call ptr @objc_msgSend(ptr noundef [[SEVEN]], ptr noundef [[TEN]], ptr noundef [[EIGHT]]) +// CHECK-NEXT: store ptr [[CALL1]], ptr [[oldObject:%.*]], align 8 val = (dictionary[key] = newObject); -// CHECK: [[FOURTEEN:%.*]] = load i8*, i8** [[NEWOBJECT:%.*]], align 8 -// CHECK-NEXT: [[TWELVE:%.*]] = load {{%.*}} [[DICTIONARY]], align 8 -// CHECK-NEXT: [[THIRTEEN:%.*]] = load i8*, i8** [[KEY]], align 8 -// CHECK-NEXT: [[SEVENTEEN:%.*]] = bitcast {{%.*}} [[TWELVE]] to i8* -// CHECK-NEXT: [[SIXTEEN:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.6 -// CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* noundef [[SEVENTEEN]], i8* noundef [[SIXTEEN]], i8* noundef [[FOURTEEN]], i8* noundef [[THIRTEEN]]) -// CHECK-NEXT: store i8* [[FOURTEEN]], i8** [[val:%.*]] +// CHECK: [[FOURTEEN:%.*]] = load ptr, ptr [[NEWOBJECT:%.*]], align 8 +// CHECK-NEXT: [[TWELVE:%.*]] = load {{.*}} [[DICTIONARY]], align 8 +// CHECK-NEXT: [[THIRTEEN:%.*]] = load ptr, ptr [[KEY]], align 8 +// CHECK-NEXT: [[SIXTEEN:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.6 +// CHECK-NEXT: call void @objc_msgSend(ptr noundef [[TWELVE]], ptr noundef [[SIXTEEN]], ptr noundef [[FOURTEEN]], ptr noundef [[THIRTEEN]]) +// CHECK-NEXT: store ptr [[FOURTEEN]], ptr [[val:%.*]] } diff --git a/clang/test/CodeGenObjC/objc2-legacy-dispatch.m b/clang/test/CodeGenObjC/objc2-legacy-dispatch.m index fc42a88..5eee32b 100644 --- a/clang/test/CodeGenObjC/objc2-legacy-dispatch.m +++ b/clang/test/CodeGenObjC/objc2-legacy-dispatch.m @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -no-opaque-pointers -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s +// RUN: %clang_cc1 -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s // // CHECK_NEW_DISPATCH-LABEL: define{{.*}} void @f0 -// CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc +// CHECK_NEW_DISPATCH: @_objc_msgSend_fixup_alloc // CHECK_NEW_DISPATCH-LABEL: define{{.*}} void @f1 // CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES // -// RUN: %clang_cc1 -no-opaque-pointers -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s +// RUN: %clang_cc1 -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s // // CHECK_OLD_DISPATCH-LABEL: define {{.*}}void @f0 // CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES diff --git a/clang/test/CodeGenObjC/os_log.m b/clang/test/CodeGenObjC/os_log.m index 323a85d..a580102 100644 --- a/clang/test/CodeGenObjC/os_log.m +++ b/clang/test/CodeGenObjC/os_log.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -disable-llvm-passes | FileCheck %s --check-prefixes=CHECK,CHECK-O2 -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s --check-prefixes=CHECK,CHECK-O0 -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple x86_64-darwin-apple -O2 -disable-llvm-passes | FileCheck %s --check-prefix=CHECK-MRR +// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -disable-llvm-passes | FileCheck %s --check-prefixes=CHECK,CHECK-O2 +// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s --check-prefixes=CHECK,CHECK-O0 +// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -O2 -disable-llvm-passes | FileCheck %s --check-prefix=CHECK-MRR // Make sure we emit clang.arc.use before calling objc_release as part of the // cleanup. This way we make sure the object will not be released until the @@ -20,37 +20,30 @@ extern __attribute__((visibility("default"))) NSString *GenString(void); void os_log_pack_send(void *); // CHECK-LABEL: define{{.*}} void @test_builtin_os_log1( -// CHECK: alloca i8*, align 8 -// CHECK: %[[A_ADDR:.*]] = alloca i8*, align 8 -// CHECK: %[[OS_LOG_ARG:.*]] = alloca %{{.*}}*, align 8 -// CHECK-O2: %[[V0:.*]] = call i8* @llvm.objc.retain( -// CHECK-O2: store i8* %[[V0]], i8** %[[A_ADDR]], align 8, -// CHECK-O0: call void @llvm.objc.storeStrong(i8** %[[A_ADDR]], i8* %{{.*}}) -// CHECK-O2: %[[V4:.*]] = call %{{.*}}* @GenString() [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] -// CHECK-O0: %[[CALL:.*]] = call %{{.*}}* @GenString() -// CHECK-O0: %[[V2:.*]] = bitcast %{{.*}}* %[[CALL]] to i8* -// CHECK-O0: %[[V3:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[V2]]) -// CHECK-O0: %[[V4:.*]] = bitcast i8* %[[V3]] to %{{.*}}* -// CHECK: %[[V5:.*]] = bitcast %{{.*}}* %[[V4]] to i8* -// CHECK: %[[V6:.*]] = call i8* @llvm.objc.retain(i8* %[[V5]]) -// CHECK: %[[V7:.*]] = bitcast i8* %[[V6]] to %{{.*}}* -// CHECK: store %{{.*}}* %[[V7]], %{{.*}}** %[[OS_LOG_ARG]], -// CHECK: %[[V8:.*]] = ptrtoint %{{.*}}* %[[V7]] to i64 -// CHECK: %[[V9:.*]] = load i8*, i8** %[[A_ADDR]], align 8 -// CHECK: %[[V10:.*]] = ptrtoint i8* %[[V9]] to i64 -// CHECK: call void @__os_log_helper_1_2_2_8_64_8_64(i8* noundef %{{.*}}, i64 noundef %[[V8]], i64 noundef %[[V10]]) -// CHECK: %[[V11:.*]] = bitcast %{{.*}}* %[[V4]] to i8* -// CHECK: call void @llvm.objc.release(i8* %[[V11]]) -// CHECK: call void @os_log_pack_send(i8* noundef %{{.*}}) -// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(%{{.*}}* %[[V7]]) -// CHECK-O2: %[[V13:.*]] = load %{{.*}}*, %{{.*}}** %[[OS_LOG_ARG]], align 8 -// CHECK-O2: %[[V14:.*]] = bitcast %{{.*}}* %[[V13]] to i8* -// CHECK-O2: call void @llvm.objc.release(i8* %[[V14]]) -// CHECK-O2: %[[V15:.*]] = load i8*, i8** %[[A_ADDR]], align 8 -// CHECK-O2: call void @llvm.objc.release(i8* %[[V15]]) -// CHECK-O0: %[[V12:.*]] = bitcast %{{.*}}** %[[OS_LOG_ARG]] to i8** -// CHECK-O0: call void @llvm.objc.storeStrong(i8** %[[V12]], i8* null) -// CHECK-O0: call void @llvm.objc.storeStrong(i8** %[[A_ADDR]], i8* null) +// CHECK: alloca ptr, align 8 +// CHECK: %[[A_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[OS_LOG_ARG:.*]] = alloca ptr, align 8 +// CHECK-O2: %[[V0:.*]] = call ptr @llvm.objc.retain( +// CHECK-O2: store ptr %[[V0]], ptr %[[A_ADDR]], align 8, +// CHECK-O0: call void @llvm.objc.storeStrong(ptr %[[A_ADDR]], ptr %{{.*}}) +// CHECK-O2: %[[V3:.*]] = call ptr @GenString() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] +// CHECK-O0: %[[CALL:.*]] = call ptr @GenString() +// CHECK-O0: %[[V3:.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[CALL]]) +// CHECK: %[[V6:.*]] = call ptr @llvm.objc.retain(ptr %[[V3]]) +// CHECK: store ptr %[[V6]], ptr %[[OS_LOG_ARG]], +// CHECK: %[[V8:.*]] = ptrtoint ptr %[[V6]] to i64 +// CHECK: %[[V9:.*]] = load ptr, ptr %[[A_ADDR]], align 8 +// CHECK: %[[V10:.*]] = ptrtoint ptr %[[V9]] to i64 +// CHECK: call void @__os_log_helper_1_2_2_8_64_8_64(ptr noundef %{{.*}}, i64 noundef %[[V8]], i64 noundef %[[V10]]) +// CHECK: call void @llvm.objc.release(ptr %[[V3]]) +// CHECK: call void @os_log_pack_send(ptr noundef %{{.*}}) +// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(ptr %[[V6]]) +// CHECK-O2: %[[V13:.*]] = load ptr, ptr %[[OS_LOG_ARG]], align 8 +// CHECK-O2: call void @llvm.objc.release(ptr %[[V13]]) +// CHECK-O2: %[[V15:.*]] = load ptr, ptr %[[A_ADDR]], align 8 +// CHECK-O2: call void @llvm.objc.release(ptr %[[V15]]) +// CHECK-O0: call void @llvm.objc.storeStrong(ptr %[[OS_LOG_ARG]], ptr null) +// CHECK-O0: call void @llvm.objc.storeStrong(ptr %[[A_ADDR]], ptr null) // CHECK-MRR-LABEL: define{{.*}} void @test_builtin_os_log1( // CHECK-MRR-NOT: call {{.*}} @llvm.objc @@ -70,25 +63,21 @@ void test_builtin_os_log2(void *buf, id __unsafe_unretained a) { } // CHECK-LABEL: define{{.*}} void @test_builtin_os_log3( -// CHECK: alloca i8*, align 8 -// CHECK: %[[OS_LOG_ARG:.*]] = alloca i8*, align 8 -// CHECK-O2: %[[V3:.*]] = call %{{.*}}* @GenString() [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] -// CHECK-O0: %[[CALL:.*]] = call %{{.*}}* @GenString() -// CHECK-O0: %[[V1:.*]] = bitcast %{{.*}}* %[[CALL]] to i8* -// CHECK-O0: %[[V2:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[V1]]) -// CHECK-O0: %[[V3:.*]] = bitcast i8* %[[V2]] to %{{.*}}* -// CHECK: %[[V4:.*]] = bitcast %{{.*}}* %[[V3]] to i8* -// CHECK: %[[V5:.*]] = call i8* @llvm.objc.retain(i8* %[[V4]]) -// CHECK: store i8* %[[V5]], i8** %[[OS_LOG_ARG]], align 8 -// CHECK: %[[V6:.*]] = ptrtoint i8* %[[V5]] to i64 -// CHECK: call void @__os_log_helper_1_2_1_8_64(i8* noundef %{{.*}}, i64 noundef %[[V6]]) -// CHECK: %[[V7:.*]] = bitcast %{{.*}}* %[[V3]] to i8* -// CHECK: call void @llvm.objc.release(i8* %[[V7]]) -// CHECK: call void @os_log_pack_send(i8* noundef %{{.*}}) -// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(i8* %[[V5]]) -// CHECK-O2: %[[V9:.*]] = load i8*, i8** %[[OS_LOG_ARG]], align 8 -// CHECK-O2: call void @llvm.objc.release(i8* %[[V9]]) -// CHECK-O0: call void @llvm.objc.storeStrong(i8** %[[OS_LOG_ARG]], i8* null) +// CHECK: alloca ptr, align 8 +// CHECK: %[[OS_LOG_ARG:.*]] = alloca ptr, align 8 +// CHECK-O2: %[[V2:.*]] = call ptr @GenString() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] +// CHECK-O0: %[[CALL:.*]] = call ptr @GenString() +// CHECK-O0: %[[V2:.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[CALL]]) +// CHECK: %[[V5:.*]] = call ptr @llvm.objc.retain(ptr %[[V2]]) +// CHECK: store ptr %[[V5]], ptr %[[OS_LOG_ARG]], align 8 +// CHECK: %[[V6:.*]] = ptrtoint ptr %[[V5]] to i64 +// CHECK: call void @__os_log_helper_1_2_1_8_64(ptr noundef %{{.*}}, i64 noundef %[[V6]]) +// CHECK: call void @llvm.objc.release(ptr %[[V2]]) +// CHECK: call void @os_log_pack_send(ptr noundef %{{.*}}) +// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(ptr %[[V5]]) +// CHECK-O2: %[[V9:.*]] = load ptr, ptr %[[OS_LOG_ARG]], align 8 +// CHECK-O2: call void @llvm.objc.release(ptr %[[V9]]) +// CHECK-O0: call void @llvm.objc.storeStrong(ptr %[[OS_LOG_ARG]], ptr null) void test_builtin_os_log3(void *buf) { __builtin_os_log_format(buf, "capabilities: %@", (id)GenString()); @@ -96,31 +85,31 @@ void test_builtin_os_log3(void *buf) { } // CHECK-LABEL: define{{.*}} void @test_builtin_os_log4( -// CHECK: alloca i8*, align 8 -// CHECK: %[[OS_LOG_ARG:.*]] = alloca i8*, align 8 -// CHECK: %[[OS_LOG_ARG2:.*]] = alloca i8*, align 8 -// CHECK-O2: %[[V4:.*]] = call {{.*}} @objc_msgSend{{.*}} [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] +// CHECK: alloca ptr, align 8 +// CHECK: %[[OS_LOG_ARG:.*]] = alloca ptr, align 8 +// CHECK: %[[OS_LOG_ARG2:.*]] = alloca ptr, align 8 +// CHECK-O2: %[[V4:.*]] = call {{.*}} @objc_msgSend{{.*}} [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] // CHECK-O0: %[[CALL:.*]] = call {{.*}} @objc_msgSend -// CHECK-O0: %[[V4:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[CALL]]) -// CHECK: %[[V5:.*]] = call i8* @llvm.objc.retain(i8* %[[V4]]) -// CHECK: store i8* %[[V5]], i8** %[[OS_LOG_ARG]], align 8 -// CHECK: %[[V6:.*]] = ptrtoint i8* %[[V5]] to i64 -// CHECK-O2: %[[V10:.*]] = call {{.*}} @objc_msgSend{{.*}} [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ] +// CHECK-O0: %[[V4:.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[CALL]]) +// CHECK: %[[V5:.*]] = call ptr @llvm.objc.retain(ptr %[[V4]]) +// CHECK: store ptr %[[V5]], ptr %[[OS_LOG_ARG]], align 8 +// CHECK: %[[V6:.*]] = ptrtoint ptr %[[V5]] to i64 +// CHECK-O2: %[[V10:.*]] = call {{.*}} @objc_msgSend{{.*}} [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] // CHECK-O0: %[[CALL1:.*]] = call {{.*}} @objc_msgSend -// CHECK-O0: %[[V10:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[CALL1]]) -// CHECK: %[[V11:.*]] = call i8* @llvm.objc.retain(i8* %[[V10]]) -// CHECK: store i8* %[[V11]], i8** %[[OS_LOG_ARG2]], align 8 -// CHECK: %[[V12:.*]] = ptrtoint i8* %[[V11]] to i64 -// CHECK: call void @__os_log_helper_1_2_2_8_64_8_64(i8* noundef %{{.*}}, i64 noundef %[[V6]], i64 noundef %[[V12]]) -// CHECK: call void @llvm.objc.release(i8* %[[V10]]) -// CHECK: call void @llvm.objc.release(i8* %[[V4]]) -// CHECK: call void @os_log_pack_send(i8* noundef %{{.*}}) -// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(i8* %[[V11]]) -// CHECK-O2: %[[V14:.*]] = load i8*, i8** %[[OS_LOG_ARG2]], align 8 -// CHECK-O2: call void @llvm.objc.release(i8* %[[V14]]) -// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(i8* %[[V5]]) -// CHECK-O2: %[[V15:.*]] = load i8*, i8** %[[OS_LOG_ARG]], align 8 -// CHECK-O2: call void @llvm.objc.release(i8* %[[V15]]) +// CHECK-O0: %[[V10:.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[CALL1]]) +// CHECK: %[[V11:.*]] = call ptr @llvm.objc.retain(ptr %[[V10]]) +// CHECK: store ptr %[[V11]], ptr %[[OS_LOG_ARG2]], align 8 +// CHECK: %[[V12:.*]] = ptrtoint ptr %[[V11]] to i64 +// CHECK: call void @__os_log_helper_1_2_2_8_64_8_64(ptr noundef %{{.*}}, i64 noundef %[[V6]], i64 noundef %[[V12]]) +// CHECK: call void @llvm.objc.release(ptr %[[V10]]) +// CHECK: call void @llvm.objc.release(ptr %[[V4]]) +// CHECK: call void @os_log_pack_send(ptr noundef %{{.*}}) +// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(ptr %[[V11]]) +// CHECK-O2: %[[V14:.*]] = load ptr, ptr %[[OS_LOG_ARG2]], align 8 +// CHECK-O2: call void @llvm.objc.release(ptr %[[V14]]) +// CHECK-O2: call void (...) @llvm.objc.clang.arc.use(ptr %[[V5]]) +// CHECK-O2: %[[V15:.*]] = load ptr, ptr %[[OS_LOG_ARG]], align 8 +// CHECK-O2: call void @llvm.objc.release(ptr %[[V15]]) void test_builtin_os_log4(void *buf) { __builtin_os_log_format(buf, "capabilities: %@ %@", [c m0], [C m1]); diff --git a/clang/test/CodeGenObjC/parameterized_classes.m b/clang/test/CodeGenObjC/parameterized_classes.m index 0a5049d..6e48862 100644 --- a/clang/test/CodeGenObjC/parameterized_classes.m +++ b/clang/test/CodeGenObjC/parameterized_classes.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -fblocks -fobjc-arc -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-arc -emit-llvm -o - %s | FileCheck %s // Parameterized classes have no effect on code generation; this test // mainly verifies that CodeGen doesn't assert when substituted types @@ -61,26 +61,22 @@ void printMe(NSString *name) { } // CHECK-LABEL: define{{.*}} void @blockTest void blockTest(NSMutableArray *array, NSString *name) { // CHECK-NOT: ret void - // CHECK: call i8* @llvm.objc.retainBlock + // CHECK: call ptr @llvm.objc.retainBlock [array addObject: ^ { printMe(name); }]; // CHECK-NOT: ret void array[0] = ^ { printMe(name); }; - // CHECK: call i8* @llvm.objc.retainBlock + // CHECK: call ptr @llvm.objc.retainBlock // CHECK: ret void } // CHECK-LABEL: define internal void @"\01-[Derived setDest:] -// CHECK: %[[SELFADDR:.*]] = alloca %[[SELFTY:.*]]* -// CHECK: %[[AADDR:.*]] = alloca %[[IVARTY:.*]]* -// CHECK: %[[V2:.*]] = load %[[IVARTY]]*, %[[IVARTY]]** %[[AADDR]] -// CHECK: %[[V3:.*]] = load %[[SELFTY]]*, %[[SELFTY]]** %[[SELFADDR]] -// CHECK: %[[IVAR:.*]] = load i64, i64* @"OBJC_IVAR_$_Base._destination" -// CHECK: %[[V4:.*]] = bitcast %[[SELFTY]]* %[[V3]] to i8* -// CHECK: %[[ADDPTR:.*]] = getelementptr inbounds i8, i8* %[[V4]], i64 %[[IVAR]] -// CHECK: %[[V5:.*]] = bitcast i8* %[[ADDPTR]] to %[[IVARTY]]** -// CHECK: %[[V6:.*]] = bitcast %[[IVARTY]]** %[[V5]] to i8** -// CHECK: %[[V7:.*]] = bitcast %[[IVARTY]]* %[[V2]] to i8* -// CHECK: call void @llvm.objc.storeStrong(i8** %[[V6]], i8* %[[V7]]) +// CHECK: %[[SELFADDR:.*]] = alloca ptr +// CHECK: %[[AADDR:a.addr]] = alloca ptr +// CHECK: %[[V2:.*]] = load ptr, ptr %[[AADDR]] +// CHECK: %[[V3:.*]] = load ptr, ptr %[[SELFADDR]] +// CHECK: %[[IVAR:.*]] = load i64, ptr @"OBJC_IVAR_$_Base._destination" +// CHECK: %[[ADDPTR:.*]] = getelementptr inbounds i8, ptr %[[V3]], i64 %[[IVAR]] +// CHECK: call void @llvm.objc.storeStrong(ptr %[[ADDPTR]], ptr %[[V2]]) @interface Base : NSObject { DestType _destination; @@ -100,12 +96,11 @@ void blockTest(NSMutableArray *array, NSString *name) { // CHECK-LABEL: define internal void @"\01-[C0 foo1]"( // CHECK: {{.*}} = alloca // CHECK: {{.*}} = alloca -// CHECK: %[[D:.*]] = alloca %[[TY:.*]]* -// CHECK: %[[TEMP:.*]] = alloca %[[TY]]* -// CHECK: %[[V4:.*]] = load %[[TY]]*, %[[TY]]** %[[D]] -// CHECK: store %[[TY]]* %[[V4]], %[[TY]]** %[[TEMP]] -// CHECK: %[[V7:.*]] = bitcast %[[TY]]** %[[TEMP]] to i8** -// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8**)*)(i8* noundef %{{.*}}, i8* noundef %{{.*}}, i8** noundef %[[V7]]) +// CHECK: %[[D:.*]] = alloca ptr +// CHECK: %[[TEMP:.*]] = alloca ptr +// CHECK: %[[V4:.*]] = load ptr, ptr %[[D]] +// CHECK: store ptr %[[V4]], ptr %[[TEMP]] +// CHECK: call void @objc_msgSend(ptr noundef %{{.*}}, ptr noundef %{{.*}}, ptr noundef %[[TEMP]]) @interface P0 : NSObject - (void)m0:(ObjectType *)first; diff --git a/clang/test/CodeGenObjC/property-ref-cast-to-void.m b/clang/test/CodeGenObjC/property-ref-cast-to-void.m index 4888414..5227375 100644 --- a/clang/test/CodeGenObjC/property-ref-cast-to-void.m +++ b/clang/test/CodeGenObjC/property-ref-cast-to-void.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s // rdar: // 8399655 @interface TestClass @@ -14,5 +14,5 @@ void FUNC (void) { (void)obj.myGetter; } -// CHECK: call i32 bitcast -// CHECK: call double bitcast +// CHECK: call i32 +// CHECK: call double diff --git a/clang/test/CodeGenObjC/property-type-mismatch.m b/clang/test/CodeGenObjC/property-type-mismatch.m index 6dade8b..93947c9 100644 --- a/clang/test/CodeGenObjC/property-type-mismatch.m +++ b/clang/test/CodeGenObjC/property-type-mismatch.m @@ -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://8966864 @interface Foo @@ -10,8 +10,8 @@ void bar(Foo *x) { x.myfo++; } -// CHECK: [[C1:%.*]] = call float bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[C1:%.*]] = call float @objc_msgSend // CHECK: [[I:%.*]] = fadd float [[C1]], 1.000000e+00 // CHECK: [[CONV:%.*]] = fptosi float [[I]] to i32 -// CHECK: [[T3:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.2 -// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[T3:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.2 +// CHECK: call void @objc_msgSend diff --git a/clang/test/CodeGenObjC/property.m b/clang/test/CodeGenObjC/property.m index 2f5a17f..ad2a0d8 100644 --- a/clang/test/CodeGenObjC/property.m +++ b/clang/test/CodeGenObjC/property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s // TODO: actually test most of this instead of just emitting it @@ -57,24 +57,20 @@ int printf(const char *, ...); // CHECK-LABEL: define{{.*}} void @test2 A *test2_helper(void); void test2(void) { - // CHECK: [[BASE:%.*]] = call [[A:%.*]]* @test2_helper() - // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: [[SEL:%.*]] = load i8*, i8** - // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* noundef [[BASETMP]], i8* noundef [[SEL]]) + // CHECK: [[BASE:%.*]] = call ptr @test2_helper() + // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr + // CHECK-NEXT: [[LD:%.*]] = call i32 @objc_msgSend(ptr noundef [[BASE]], ptr noundef [[SEL]]) // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[LD]], 1 - // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: [[SEL:%.*]] = load i8*, i8** - // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* noundef [[BASETMP]], i8* noundef [[SEL]], i32 noundef [[ADD]]) + // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr + // CHECK-NEXT: call void @objc_msgSend(ptr noundef [[BASE]], ptr noundef [[SEL]], i32 noundef [[ADD]]) test2_helper().dyn++; - // CHECK: [[BASE:%.*]] = call [[A]]* @test2_helper() - // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: [[SEL:%.*]] = load i8*, i8** - // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* noundef [[BASETMP]], i8* noundef [[SEL]]) + // CHECK: [[BASE:%.*]] = call ptr @test2_helper() + // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr + // CHECK-NEXT: [[LD:%.*]] = call i32 @objc_msgSend(ptr noundef [[BASE]], ptr noundef [[SEL]]) // CHECK-NEXT: [[ADD:%.*]] = mul nsw i32 [[LD]], 10 - // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: [[SEL:%.*]] = load i8*, i8** - // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* noundef [[BASETMP]], i8* noundef [[SEL]], i32 noundef [[ADD]]) + // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr + // CHECK-NEXT: call void @objc_msgSend(ptr noundef [[BASE]], ptr noundef [[SEL]], i32 noundef [[ADD]]) test2_helper().dyn *= 10; } @@ -97,9 +93,9 @@ void test3(test3_object *p) { // CHECK-LABEL: define{{.*}} void @test4 void test4(Test4 *t) { extern int test4_printf(const char *, ...); - // CHECK: [[TMP:%.*]] = call float {{.*}} @objc_msgSend + // CHECK: [[TMP:%.*]] = call float @objc_msgSend // CHECK-NEXT: [[EXT:%.*]] = fpext float [[TMP]] to double - // CHECK-NEXT: call i32 (i8*, ...) @test4_printf(i8* {{.*}}, double noundef [[EXT]]) + // CHECK-NEXT: call i32 (ptr, ...) @test4_printf(ptr {{.*}}, double noundef [[EXT]]) // CHECK-NEXT: ret void test4_printf("%.2f", t.f); } @@ -132,37 +128,31 @@ void test7(Test7 *t) { t.x |= 5; t.x ^= 8; } -// CHECK: define{{.*}} void @test7([[TEST7:%.*]]* -// CHECK: [[T:%.*]] = alloca [[TEST7]]*, +// CHECK: define{{.*}} void @test7(ptr +// CHECK: [[T:%.*]] = alloca ptr, // CHECK-NEXT: store -// CHECK-NEXT: [[T0:%.*]] = load [[TEST7]]*, [[TEST7]]** [[T]], align -// CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST7]]* [[T0]] to i8* -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES -// CHECK-NEXT: [[T2:%.*]] = call zeroext i8 bitcast +// CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[T]], align +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: [[T2:%.*]] = call zeroext i8 // CHECK-NEXT: [[T3:%.*]] = zext i8 [[T2]] to i32 // CHECK-NEXT: [[T4:%.*]] = and i32 [[T3]], 2 // CHECK-NEXT: [[T5:%.*]] = trunc i32 [[T4]] to i8 -// CHECK-NEXT: [[T6:%.*]] = bitcast [[TEST7]]* [[T0]] to i8* -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES -// CHECK-NEXT: call void bitcast -// CHECK-NEXT: [[T0:%.*]] = load [[TEST7]]*, [[TEST7]]** [[T]], align -// CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST7]]* [[T0]] to i8* -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES -// CHECK-NEXT: [[T2:%.*]] = call zeroext i8 bitcast +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: call void +// CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[T]], align +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: [[T2:%.*]] = call zeroext i8 // CHECK-NEXT: [[T3:%.*]] = zext i8 [[T2]] to i32 // CHECK-NEXT: [[T4:%.*]] = or i32 [[T3]], 5 // CHECK-NEXT: [[T5:%.*]] = trunc i32 [[T4]] to i8 -// CHECK-NEXT: [[T6:%.*]] = bitcast [[TEST7]]* [[T0]] to i8* -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES -// CHECK-NEXT: call void bitcast -// CHECK-NEXT: [[T0:%.*]] = load [[TEST7]]*, [[TEST7]]** [[T]], align -// CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST7]]* [[T0]] to i8* -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES -// CHECK-NEXT: [[T2:%.*]] = call zeroext i8 bitcast +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: call void +// CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[T]], align +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: [[T2:%.*]] = call zeroext i8 // CHECK-NEXT: [[T3:%.*]] = zext i8 [[T2]] to i32 // CHECK-NEXT: [[T4:%.*]] = xor i32 [[T3]], 8 // CHECK-NEXT: [[T5:%.*]] = trunc i32 [[T4]] to i8 -// CHECK-NEXT: [[T6:%.*]] = bitcast [[TEST7]]* [[T0]] to i8* -// CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES -// CHECK-NEXT: call void bitcast +// CHECK-NEXT: load ptr, ptr @OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: call void // CHECK-NEXT: ret void diff --git a/clang/test/CodeGenObjC/protocols.m b/clang/test/CodeGenObjC/protocols.m index 2ea9ac7..5f63610 100644 --- a/clang/test/CodeGenObjC/protocols.m +++ b/clang/test/CodeGenObjC/protocols.m @@ -1,19 +1,19 @@ -// 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 // CHECK: @"_OBJC_$_PROTOCOL_METHOD_TYPES_P1" = internal global // CHECK: @[[PROTO_P1:"_OBJC_PROTOCOL_\$_P1"]] = weak hidden -// CHECK: @[[LABEL_PROTO_P1:"_OBJC_LABEL_PROTOCOL_\$_P1"]] = weak hidden global %{{.*}}* @[[PROTO_P1]] +// CHECK: @[[LABEL_PROTO_P1:"_OBJC_LABEL_PROTOCOL_\$_P1"]] = weak hidden global ptr @[[PROTO_P1]] // CHECK: @[[PROTO_P2:"_OBJC_PROTOCOL_\$_P2"]] = weak hidden -// CHECK: @[[LABEL_PROTO_P2:"_OBJC_LABEL_PROTOCOL_\$_P2"]] = weak hidden global %{{.*}}* @[[PROTO_P2]] -// CHECK: @"_OBJC_$_PROTOCOL_REFS_P3" = internal global { i64, [3 x %{{.*}}] } { i64 2, [3 x %{{.*}}*] [%{{.*}}* @[[PROTO_P1]], %{{.*}}* @[[PROTO_P2]], %{{.*}}* null] } +// CHECK: @[[LABEL_PROTO_P2:"_OBJC_LABEL_PROTOCOL_\$_P2"]] = weak hidden global ptr @[[PROTO_P2]] +// CHECK: @"_OBJC_$_PROTOCOL_REFS_P3" = internal global { i64, [3 x ptr] } { i64 2, [3 x ptr] [ptr @[[PROTO_P1]], ptr @[[PROTO_P2]], ptr null] } // CHECK: @[[PROTO_P3:"_OBJC_PROTOCOL_\$_P3"]] = weak hidden -// CHECK: @[[LABEL_PROTO_P3:"_OBJC_LABEL_PROTOCOL_\$_P3"]] = weak hidden global %{{.*}}* @[[PROTO_P3]] -// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P3" = weak hidden global %{{.*}}* bitcast (%{{.*}}* @[[PROTO_P3]] to %{{.*}}*) +// CHECK: @[[LABEL_PROTO_P3:"_OBJC_LABEL_PROTOCOL_\$_P3"]] = weak hidden global ptr @[[PROTO_P3]] +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P3" = weak hidden global ptr @[[PROTO_P3]] // CHECK: @[[PROTO_P0:"_OBJC_PROTOCOL_\$_P0"]] = weak hidden -// CHECK: @[[LABEL_PROTO_P0:"_OBJC_LABEL_PROTOCOL_\$_P0"]] = weak hidden global %{{.*}}* @[[PROTO_P0]] -// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P0]] to %{{.*}}*) -// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P1" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P1]] to %{{.*}}*) -// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P2" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P2]] to %{{.*}}*) +// CHECK: @[[LABEL_PROTO_P0:"_OBJC_LABEL_PROTOCOL_\$_P0"]] = weak hidden global ptr @[[PROTO_P0]] +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global ptr @[[PROTO_P0]] +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P1" = weak hidden global ptr @[[PROTO_P1]] +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P2" = weak hidden global ptr @[[PROTO_P2]] void p(const char*, ...); diff --git a/clang/test/CodeGenObjC/stret-lifetime.m b/clang/test/CodeGenObjC/stret-lifetime.m index 291530c..55b19aa 100644 --- a/clang/test/CodeGenObjC/stret-lifetime.m +++ b/clang/test/CodeGenObjC/stret-lifetime.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-darwin -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-darwin -fobjc-arc -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s --check-prefixes=CHECK,ARC -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -fobjc-arc -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s --check-prefixes=CHECK,ARC +// RUN: %clang_cc1 -triple arm64-apple-darwin -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-darwin -fobjc-arc -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s --check-prefixes=CHECK,ARC +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc -S -emit-llvm -o - -O2 -disable-llvm-passes %s | FileCheck %s --check-prefixes=CHECK,ARC struct stret { int x[100]; }; struct stret one = {{1}}; @@ -14,16 +14,16 @@ struct stret one = {{1}}; void foo(id o, id p) { [o method]; // CHECK: @llvm.lifetime.start - // CHECK: call void bitcast {{.*}} @objc_msgSend + // CHECK: call void @objc_msgSend // CHECK: @llvm.lifetime.end // CHECK-NOT: call void @llvm.memset [o methodConsuming:p]; - // ARC: [[T0:%.*]] = icmp eq i8* + // ARC: [[T0:%.*]] = icmp eq ptr // ARC: br i1 [[T0]] // CHECK: @llvm.lifetime.start - // CHECK: call void bitcast {{.*}} @objc_msgSend + // CHECK: call void @objc_msgSend // CHECK: @llvm.lifetime.end // ARC: br label diff --git a/clang/test/CodeGenObjC/stret_lookup.m b/clang/test/CodeGenObjC/stret_lookup.m index c7703648..1a4665d 100644 --- a/clang/test/CodeGenObjC/stret_lookup.m +++ b/clang/test/CodeGenObjC/stret_lookup.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -DSTRET -triple x86_64-pc-linux-gnu -fobjc-runtime=objfw -emit-llvm -o - %s | FileCheck -check-prefix=HASSTRET %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-pc-linux-gnu -fobjc-runtime=gcc -emit-llvm -o - %s | FileCheck -check-prefix=NOSTRET %s +// RUN: %clang_cc1 -DSTRET -triple x86_64-pc-linux-gnu -fobjc-runtime=objfw -emit-llvm -o - %s | FileCheck -check-prefix=HASSTRET %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fobjc-runtime=gcc -emit-llvm -o - %s | FileCheck -check-prefix=NOSTRET %s // Test stret lookup @@ -19,11 +19,9 @@ void test0(void) { } // HASSTRET-LABEL: define{{.*}} void @test0() -// HASSTRET: [[T0:%.*]] = call i8* (i8*, i8*, ...)* @objc_msg_lookup_stret(i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*), -// HASSTRET-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (%struct.test*, i8*, i8*)* -// HASSTRET-NEXT: call void [[T1]](%struct.test* sret(%struct.test) {{.*}}, i8* noundef bitcast (i64* @_OBJC_CLASS_Test0 to i8*), +// HASSTRET: [[T0:%.*]] = call ptr @objc_msg_lookup_stret(ptr @_OBJC_CLASS_Test0, +// HASSTRET-NEXT: call void [[T0]](ptr sret(%struct.test) {{.*}}, ptr noundef @_OBJC_CLASS_Test0, // NOSTRET-LABEL: define{{.*}} void @test0() -// NOSTRET: [[T0:%.*]] = call i8* (i8*, i8*, ...)* @objc_msg_lookup(i8* -// NOSTRET-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (%struct.test*, i8*, i8*)* -// NOSTRET-NEXT: call void [[T1]](%struct.test* sret(%struct.test) {{.*}}, i8* {{.*}}, i8* noundef bitcast ([2 x { i8*, i8* }]* +// NOSTRET: [[T0:%.*]] = call ptr @objc_msg_lookup(ptr +// NOSTRET-NEXT: call void [[T0]](ptr sret(%struct.test) {{.*}}, ptr {{.*}}, ptr noundef diff --git a/clang/test/CodeGenObjC/strong-in-c-struct.m b/clang/test/CodeGenObjC/strong-in-c-struct.m index 457dce3..3857d10 100644 --- a/clang/test/CodeGenObjC/strong-in-c-struct.m +++ b/clang/test/CodeGenObjC/strong-in-c-struct.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-llvm -o - -DUSESTRUCT %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-llvm -o - -DUSESTRUCT %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-pch -o %t %s -// RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -include-pch %t -emit-llvm -o - -DUSESTRUCT %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-pch -o %t %s +// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -include-pch %t -emit-llvm -o - -DUSESTRUCT %s | FileCheck %s #ifndef HEADER #define HEADER @@ -103,186 +103,145 @@ void func(Strong *); id g0; StrongSmall g1, g2; -// CHECK: %[[STRUCT_STRONGSMALL:.*]] = type { i32, i8* } -// CHECK: %[[STRUCT_STRONGOUTER:.*]] = type { %[[STRUCT_STRONG:.*]], i8*, double } -// CHECK: %[[STRUCT_STRONG]] = type { %[[STRUCT_TRIVIAL:.*]], i8* } +// CHECK: %[[STRUCT_STRONGSMALL:.*]] = type { i32, ptr } +// CHECK: %[[STRUCT_STRONGOUTER:.*]] = type { %[[STRUCT_STRONG:.*]], ptr, double } +// CHECK: %[[STRUCT_STRONG]] = type { %[[STRUCT_TRIVIAL:.*]], ptr } // CHECK: %[[STRUCT_TRIVIAL]] = type { [4 x i32] } -// CHECK: %[[STRUCT_BLOCK_BYREF_T:.*]] = type { i8*, %[[STRUCT_BLOCK_BYREF_T]]*, i32, i32, i8*, i8*, i8*, %[[STRUCT_STRONGOUTER]] } -// CHECK: %[[STRUCT_STRONGBLOCK:.*]] = type { void ()* } -// CHECK: %[[STRUCT_BITFIELD1:.*]] = type { i8, i8, i8*, i32, i8*, [3 x i32], i8*, double, i8, i8 } +// CHECK: %[[STRUCT_BLOCK_BYREF_T:.*]] = type { ptr, ptr, i32, i32, ptr, ptr, ptr, %[[STRUCT_STRONGOUTER]] } +// CHECK: %[[STRUCT_STRONGBLOCK:.*]] = type { ptr } +// CHECK: %[[STRUCT_BITFIELD1:.*]] = type { i8, i8, ptr, i32, ptr, [3 x i32], ptr, double, i8, i8 } // CHECK: define{{.*}} void @test_constructor_destructor_StrongOuter() // CHECK: %[[T:.*]] = alloca %[[STRUCT_STRONGOUTER]], align 8 -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[T]] to i8** -// CHECK: call void @__default_constructor_8_S_s16_s24(i8** %[[V0]]) -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[T]] to i8** -// CHECK: call void @__destructor_8_S_s16_s24(i8** %[[V1]]) +// CHECK: call void @__default_constructor_8_S_s16_s24(ptr %[[T]]) +// CHECK: call void @__destructor_8_S_s16_s24(ptr %[[T]]) // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__default_constructor_8_S_s16_s24(i8** noundef %[[DST:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: call void @__default_constructor_8_s16(i8** %[[V0]]) -// CHECK: %[[V1:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V2:.*]] = getelementptr inbounds i8, i8* %[[V1]], i64 24 -// CHECK: %[[V3:.*]] = bitcast i8* %[[V2]] to i8** -// CHECK: %[[V4:.*]] = bitcast i8** %[[V3]] to i8* -// CHECK: call void @llvm.memset.p0i8.i64(i8* align 8 %[[V4]], i8 0, i64 8, i1 false) +// CHECK: define linkonce_odr hidden void @__default_constructor_8_S_s16_s24(ptr noundef %[[DST:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: call void @__default_constructor_8_s16(ptr %[[V0]]) +// CHECK: %[[V2:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 24 +// CHECK: call void @llvm.memset.p0.i64(ptr align 8 %[[V2]], i8 0, i64 8, i1 false) // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__default_constructor_8_s16(i8** noundef %[[DST:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V2:.*]] = getelementptr inbounds i8, i8* %[[V1]], i64 16 -// CHECK: %[[V3:.*]] = bitcast i8* %[[V2]] to i8** -// CHECK: %[[V4:.*]] = bitcast i8** %[[V3]] to i8* -// CHECK: call void @llvm.memset.p0i8.i64(i8* align 8 %[[V4]], i8 0, i64 8, i1 false) +// CHECK: define linkonce_odr hidden void @__default_constructor_8_s16(ptr noundef %[[DST:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V2:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 16 +// CHECK: call void @llvm.memset.p0.i64(ptr align 8 %[[V2]], i8 0, i64 8, i1 false) // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__destructor_8_S_s16_s24(i8** noundef %[[DST:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: call void @__destructor_8_s16(i8** %[[V0]]) -// CHECK: %[[V1:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V2:.*]] = getelementptr inbounds i8, i8* %[[V1]], i64 24 -// CHECK: %[[V3:.*]] = bitcast i8* %[[V2]] to i8** -// CHECK: call void @llvm.objc.storeStrong(i8** %[[V3]], i8* null) +// CHECK: define linkonce_odr hidden void @__destructor_8_S_s16_s24(ptr noundef %[[DST:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: call void @__destructor_8_s16(ptr %[[V0]]) +// CHECK: %[[V2:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 24 +// CHECK: call void @llvm.objc.storeStrong(ptr %[[V2]], ptr null) // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__destructor_8_s16(i8** noundef %[[DST:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V2:.*]] = getelementptr inbounds i8, i8* %[[V1]], i64 16 -// CHECK: %[[V3:.*]] = bitcast i8* %[[V2]] to i8** -// CHECK: call void @llvm.objc.storeStrong(i8** %[[V3]], i8* null) +// CHECK: define linkonce_odr hidden void @__destructor_8_s16(ptr noundef %[[DST:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V2:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 16 +// CHECK: call void @llvm.objc.storeStrong(ptr %[[V2]], ptr null) // CHECK: ret void void test_constructor_destructor_StrongOuter(void) { StrongOuter t; } -// CHECK: define{{.*}} void @test_copy_constructor_StrongOuter(%[[STRUCT_STRONGOUTER]]* noundef %[[S:.*]]) -// CHECK: %[[S_ADDR:.*]] = alloca %[[STRUCT_STRONGOUTER]]*, align 8 +// CHECK: define{{.*}} void @test_copy_constructor_StrongOuter(ptr noundef %[[S:.*]]) +// CHECK: %[[S_ADDR:.*]] = alloca ptr, align 8 // CHECK: %[[T:.*]] = alloca %[[STRUCT_STRONGOUTER]], align 8 -// CHECK: store %[[STRUCT_STRONGOUTER]]* %[[S]], %[[STRUCT_STRONGOUTER]]** %[[S_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load %[[STRUCT_STRONGOUTER]]*, %[[STRUCT_STRONGOUTER]]** %[[S_ADDR]], align 8 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[T]] to i8** -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[V0]] to i8** -// CHECK: call void @__copy_constructor_8_8_S_t0w16_s16_s24_t32w8(i8** %[[V1]], i8** %[[V2]]) -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[T]] to i8** -// CHECK: call void @__destructor_8_S_s16_s24(i8** %[[V3]]) +// CHECK: store ptr %[[S]], ptr %[[S_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[S_ADDR]], align 8 +// CHECK: call void @__copy_constructor_8_8_S_t0w16_s16_s24_t32w8(ptr %[[T]], ptr %[[V0]]) +// CHECK: call void @__destructor_8_S_s16_s24(ptr %[[T]]) // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_S_t0w16_s16_s24_t32w8(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: call void @__copy_constructor_8_8_t0w16_s16(i8** %[[V0]], i8** %[[V1]]) -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V3:.*]] = getelementptr inbounds i8, i8* %[[V2]], i64 24 -// CHECK: %[[V4:.*]] = bitcast i8* %[[V3]] to i8** -// CHECK: %[[V5:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V6:.*]] = getelementptr inbounds i8, i8* %[[V5]], i64 24 -// CHECK: %[[V7:.*]] = bitcast i8* %[[V6]] to i8** -// CHECK: %[[V8:.*]] = load i8*, i8** %[[V7]], align 8 -// CHECK: %[[V9:.*]] = call i8* @llvm.objc.retain(i8* %[[V8]]) -// CHECK: store i8* %[[V9]], i8** %[[V4]], align 8 -// CHECK: %[[V10:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V11:.*]] = getelementptr inbounds i8, i8* %[[V10]], i64 32 -// CHECK: %[[V12:.*]] = bitcast i8* %[[V11]] to i8** -// CHECK: %[[V13:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V14:.*]] = getelementptr inbounds i8, i8* %[[V13]], i64 32 -// CHECK: %[[V15:.*]] = bitcast i8* %[[V14]] to i8** -// CHECK: %[[V16:.*]] = bitcast i8** %[[V12]] to i64* -// CHECK: %[[V17:.*]] = bitcast i8** %[[V15]] to i64* -// CHECK: %[[V18:.*]] = load i64, i64* %[[V17]], align 8 -// CHECK: store i64 %[[V18]], i64* %[[V16]], align 8 +// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_S_t0w16_s16_s24_t32w8(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: call void @__copy_constructor_8_8_t0w16_s16(ptr %[[V0]], ptr %[[V1]]) +// CHECK: %[[V3:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 24 +// CHECK: %[[V6:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 24 +// CHECK: %[[V8:.*]] = load ptr, ptr %[[V6]], align 8 +// CHECK: %[[V9:.*]] = call ptr @llvm.objc.retain(ptr %[[V8]]) +// CHECK: store ptr %[[V9]], ptr %[[V3]], align 8 +// CHECK: %[[V11:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 32 +// CHECK: %[[V14:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 32 +// CHECK: %[[V18:.*]] = load i64, ptr %[[V14]], align 8 +// CHECK: store i64 %[[V18]], ptr %[[V11]], align 8 // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_t0w16_s16(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V3:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %[[V2]], i8* align 8 %[[V3]], i64 16, i1 false) -// CHECK: %[[V4:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V5:.*]] = getelementptr inbounds i8, i8* %[[V4]], i64 16 -// CHECK: %[[V6:.*]] = bitcast i8* %[[V5]] to i8** -// CHECK: %[[V7:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V8:.*]] = getelementptr inbounds i8, i8* %[[V7]], i64 16 -// CHECK: %[[V9:.*]] = bitcast i8* %[[V8]] to i8** -// CHECK: %[[V10:.*]] = load i8*, i8** %[[V9]], align 8 -// CHECK: %[[V11:.*]] = call i8* @llvm.objc.retain(i8* %[[V10]]) -// CHECK: store i8* %[[V11]], i8** %[[V6]], align 8 +// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_t0w16_s16(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[V0]], ptr align 8 %[[V1]], i64 16, i1 false) +// CHECK: %[[V5:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 16 +// CHECK: %[[V8:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 16 +// CHECK: %[[V10:.*]] = load ptr, ptr %[[V8]], align 8 +// CHECK: %[[V11:.*]] = call ptr @llvm.objc.retain(ptr %[[V10]]) +// CHECK: store ptr %[[V11]], ptr %[[V5]], align 8 // CHECK: ret void void test_copy_constructor_StrongOuter(StrongOuter *s) { StrongOuter t = *s; } -/// CHECK: define linkonce_odr hidden void @__copy_assignment_8_8_S_t0w16_s16_s24_t32w8(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V3:.*]] = getelementptr inbounds i8, i8* %[[V2]], i64 24 -// CHECK: %[[V4:.*]] = bitcast i8* %[[V3]] to i8** -// CHECK: %[[V5:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V6:.*]] = getelementptr inbounds i8, i8* %[[V5]], i64 24 -// CHECK: %[[V7:.*]] = bitcast i8* %[[V6]] to i8** -// CHECK: %[[V8:.*]] = load i8*, i8** %[[V7]], align 8 -// CHECK: call void @llvm.objc.storeStrong(i8** %[[V4]], i8* %[[V8]]) +/// CHECK: define linkonce_odr hidden void @__copy_assignment_8_8_S_t0w16_s16_s24_t32w8(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V3:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 24 +// CHECK: %[[V6:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 24 +// CHECK: %[[V8:.*]] = load ptr, ptr %[[V6]], align 8 +// CHECK: call void @llvm.objc.storeStrong(ptr %[[V3]], ptr %[[V8]]) void test_copy_assignment_StrongOuter(StrongOuter *d, StrongOuter *s) { *d = *s; } // CHECK: define{{.*}} void @test_move_constructor_StrongOuter() -// CHECK: %[[T1:.*]] = getelementptr inbounds %[[STRUCT_BLOCK_BYREF_T]], %[[STRUCT_BLOCK_BYREF_T]]* %{{.*}}, i32 0, i32 7 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[T1]] to i8** -// CHECK: call void @__default_constructor_8_S_s16_s24(i8** %[[V1]]) -// CHECK: %[[T2:.*]] = getelementptr inbounds %[[STRUCT_BLOCK_BYREF_T]], %[[STRUCT_BLOCK_BYREF_T]]* %{{.*}}, i32 0, i32 7 -// CHECK: %[[V9:.*]] = bitcast %[[STRUCT_STRONGOUTER]]* %[[T2]] to i8** -// CHECK: call void @__destructor_8_S_s16_s24(i8** %[[V9]]) - -// CHECK: define internal void @__Block_byref_object_copy_(i8* noundef %0, i8* noundef %1) +// CHECK: %[[T1:.*]] = getelementptr inbounds %[[STRUCT_BLOCK_BYREF_T]], ptr %{{.*}}, i32 0, i32 7 +// CHECK: call void @__default_constructor_8_S_s16_s24(ptr %[[T1]]) +// CHECK: %[[T2:.*]] = getelementptr inbounds %[[STRUCT_BLOCK_BYREF_T]], ptr %{{.*}}, i32 0, i32 7 +// CHECK: call void @__destructor_8_S_s16_s24(ptr %[[T2]]) + +// CHECK: define internal void @__Block_byref_object_copy_(ptr noundef %0, ptr noundef %1) // CHECK: call void @__move_constructor_8_8_S_t0w16_s16_s24_t32w8( -// CHECK: define linkonce_odr hidden void @__move_constructor_8_8_S_t0w16_s16_s24_t32w8(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: call void @__move_constructor_8_8_t0w16_s16(i8** %[[V0]], i8** %[[V1]]) -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V3:.*]] = getelementptr inbounds i8, i8* %[[V2]], i64 24 -// CHECK: %[[V4:.*]] = bitcast i8* %[[V3]] to i8** -// CHECK: %[[V5:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V6:.*]] = getelementptr inbounds i8, i8* %[[V5]], i64 24 -// CHECK: %[[V7:.*]] = bitcast i8* %[[V6]] to i8** -// CHECK: %[[V8:.*]] = load i8*, i8** %[[V7]], align 8 -// CHECK: store i8* null, i8** %[[V7]], align 8 -// CHECK: store i8* %[[V8]], i8** %[[V4]], align 8 - -// CHECK: define internal void @__Block_byref_object_dispose_(i8* noundef %0) +// CHECK: define linkonce_odr hidden void @__move_constructor_8_8_S_t0w16_s16_s24_t32w8(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: call void @__move_constructor_8_8_t0w16_s16(ptr %[[V0]], ptr %[[V1]]) +// CHECK: %[[V3:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 24 +// CHECK: %[[V6:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 24 +// CHECK: %[[V8:.*]] = load ptr, ptr %[[V6]], align 8 +// CHECK: store ptr null, ptr %[[V6]], align 8 +// CHECK: store ptr %[[V8]], ptr %[[V3]], align 8 + +// CHECK: define internal void @__Block_byref_object_dispose_(ptr noundef %0) // CHECK: call void @__destructor_8_S_s16_s24( void test_move_constructor_StrongOuter(void) { @@ -290,140 +249,115 @@ void test_move_constructor_StrongOuter(void) { BlockTy b = ^{ (void)t; }; } -// CHECK: define linkonce_odr hidden void @__move_assignment_8_8_S_t0w16_s16_s24_t32w8(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: call void @__move_assignment_8_8_t0w16_s16(i8** %[[V0]], i8** %[[V1]]) -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V3:.*]] = getelementptr inbounds i8, i8* %[[V2]], i64 24 -// CHECK: %[[V4:.*]] = bitcast i8* %[[V3]] to i8** -// CHECK: %[[V5:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V6:.*]] = getelementptr inbounds i8, i8* %[[V5]], i64 24 -// CHECK: %[[V7:.*]] = bitcast i8* %[[V6]] to i8** -// CHECK: %[[V8:.*]] = load i8*, i8** %[[V7]], align 8 -// CHECK: store i8* null, i8** %[[V7]], align 8 -// CHECK: %[[V9:.*]] = load i8*, i8** %[[V4]], align 8 -// CHECK: store i8* %[[V8]], i8** %[[V4]], align 8 -// CHECK: call void @llvm.objc.release(i8* %[[V9]]) +// CHECK: define linkonce_odr hidden void @__move_assignment_8_8_S_t0w16_s16_s24_t32w8(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: call void @__move_assignment_8_8_t0w16_s16(ptr %[[V0]], ptr %[[V1]]) +// CHECK: %[[V3:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 24 +// CHECK: %[[V6:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 24 +// CHECK: %[[V8:.*]] = load ptr, ptr %[[V6]], align 8 +// CHECK: store ptr null, ptr %[[V6]], align 8 +// CHECK: %[[V9:.*]] = load ptr, ptr %[[V3]], align 8 +// CHECK: store ptr %[[V8]], ptr %[[V3]], align 8 +// CHECK: call void @llvm.objc.release(ptr %[[V9]]) void test_move_assignment_StrongOuter(StrongOuter *p) { *p = getStrongOuter(); } -// CHECK: define linkonce_odr hidden void @__default_constructor_8_s0_S_s24(i8** noundef %[[DST:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: call void @llvm.memset.p0i8.i64(i8* align 8 %[[V1]], i8 0, i64 8, i1 false) -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V3:.*]] = getelementptr inbounds i8, i8* %[[V2]], i64 8 -// CHECK: %[[V4:.*]] = bitcast i8* %[[V3]] to i8** -// CHECK: call void @__default_constructor_8_s16(i8** %[[V4]]) - -// CHECK: define linkonce_odr hidden void @__destructor_8_s0_S_s24(i8** noundef %[[DST:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: call void @llvm.objc.storeStrong(i8** %[[V0]], i8* null) -// CHECK: %[[V1:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V2:.*]] = getelementptr inbounds i8, i8* %[[V1]], i64 8 -// CHECK: %[[V3:.*]] = bitcast i8* %[[V2]] to i8** -// CHECK: call void @__destructor_8_s16(i8** %[[V3]]) +// CHECK: define linkonce_odr hidden void @__default_constructor_8_s0_S_s24(ptr noundef %[[DST:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: call void @llvm.memset.p0.i64(ptr align 8 %[[V0]], i8 0, i64 8, i1 false) +// CHECK: %[[V3:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 8 +// CHECK: call void @__default_constructor_8_s16(ptr %[[V3]]) + +// CHECK: define linkonce_odr hidden void @__destructor_8_s0_S_s24(ptr noundef %[[DST:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: call void @llvm.objc.storeStrong(ptr %[[V0]], ptr null) +// CHECK: %[[V2:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 8 +// CHECK: call void @__destructor_8_s16(ptr %[[V2]]) void test_constructor_destructor_StrongOuter2(void) { StrongOuter2 t; } -// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_s0_S_t8w16_s24(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = load i8*, i8** %[[V1]], align 8 -// CHECK: %[[V3:.*]] = call i8* @llvm.objc.retain(i8* %[[V2]]) -// CHECK: store i8* %[[V3]], i8** %[[V0]], align 8 -// CHECK: %[[V4:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V5:.*]] = getelementptr inbounds i8, i8* %[[V4]], i64 8 -// CHECK: %[[V6:.*]] = bitcast i8* %[[V5]] to i8** -// CHECK: %[[V7:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V8:.*]] = getelementptr inbounds i8, i8* %[[V7]], i64 8 -// CHECK: %[[V9:.*]] = bitcast i8* %[[V8]] to i8** -// CHECK: call void @__copy_constructor_8_8_t0w16_s16(i8** %[[V6]], i8** %[[V9]]) +// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_s0_S_t8w16_s24(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V2:.*]] = load ptr, ptr %[[V1]], align 8 +// CHECK: %[[V3:.*]] = call ptr @llvm.objc.retain(ptr %[[V2]]) +// CHECK: store ptr %[[V3]], ptr %[[V0]], align 8 +// CHECK: %[[V5:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 8 +// CHECK: %[[V8:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 8 +// CHECK: call void @__copy_constructor_8_8_t0w16_s16(ptr %[[V5]], ptr %[[V8]]) void test_copy_constructor_StrongOuter2(StrongOuter2 *s) { StrongOuter2 t = *s; } -// CHECK: define linkonce_odr hidden void @__copy_assignment_8_8_s0_S_t8w16_s24(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = load i8*, i8** %[[V1]], align 8 -// CHECK: call void @llvm.objc.storeStrong(i8** %[[V0]], i8* %[[V2]]) -// CHECK: %[[V3:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V4:.*]] = getelementptr inbounds i8, i8* %[[V3]], i64 8 -// CHECK: %[[V5:.*]] = bitcast i8* %[[V4]] to i8** -// CHECK: %[[V6:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V7:.*]] = getelementptr inbounds i8, i8* %[[V6]], i64 8 -// CHECK: %[[V8:.*]] = bitcast i8* %[[V7]] to i8** -// CHECK: call void @__copy_assignment_8_8_t0w16_s16(i8** %[[V5]], i8** %[[V8]]) +// CHECK: define linkonce_odr hidden void @__copy_assignment_8_8_s0_S_t8w16_s24(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V2:.*]] = load ptr, ptr %[[V1]], align 8 +// CHECK: call void @llvm.objc.storeStrong(ptr %[[V0]], ptr %[[V2]]) +// CHECK: %[[V4:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 8 +// CHECK: %[[V7:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 8 +// CHECK: call void @__copy_assignment_8_8_t0w16_s16(ptr %[[V4]], ptr %[[V7]]) void test_copy_assignment_StrongOuter2(StrongOuter2 *d, StrongOuter2 *s) { *d = *s; } -// CHECK: define linkonce_odr hidden void @__move_constructor_8_8_s0_S_t8w16_s24(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = load i8*, i8** %[[V1]], align 8 -// CHECK: store i8* null, i8** %[[V1]], align 8 -// CHECK: store i8* %[[V2]], i8** %[[V0]], align 8 -// CHECK: %[[V3:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V4:.*]] = getelementptr inbounds i8, i8* %[[V3]], i64 8 -// CHECK: %[[V5:.*]] = bitcast i8* %[[V4]] to i8** -// CHECK: %[[V6:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V7:.*]] = getelementptr inbounds i8, i8* %[[V6]], i64 8 -// CHECK: %[[V8:.*]] = bitcast i8* %[[V7]] to i8** -// CHECK: call void @__move_constructor_8_8_t0w16_s16(i8** %[[V5]], i8** %[[V8]]) +// CHECK: define linkonce_odr hidden void @__move_constructor_8_8_s0_S_t8w16_s24(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V2:.*]] = load ptr, ptr %[[V1]], align 8 +// CHECK: store ptr null, ptr %[[V1]], align 8 +// CHECK: store ptr %[[V2]], ptr %[[V0]], align 8 +// CHECK: %[[V4:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 8 +// CHECK: %[[V7:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 8 +// CHECK: call void @__move_constructor_8_8_t0w16_s16(ptr %[[V4]], ptr %[[V7]]) void test_move_constructor_StrongOuter2(void) { __block StrongOuter2 t; BlockTy b = ^{ (void)t; }; } -// CHECK: define linkonce_odr hidden void @__move_assignment_8_8_s0_S_t8w16_s24(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = load i8*, i8** %[[V1]], align 8 -// CHECK: store i8* null, i8** %[[V1]], align 8 -// CHECK: %[[V3:.*]] = load i8*, i8** %[[V0]], align 8 -// CHECK: store i8* %[[V2]], i8** %[[V0]], align 8 -// CHECK: call void @llvm.objc.release(i8* %[[V3]]) -// CHECK: %[[V4:.*]] = bitcast i8** %[[V0]] to i8* -// CHECK: %[[V5:.*]] = getelementptr inbounds i8, i8* %[[V4]], i64 8 -// CHECK: %[[V6:.*]] = bitcast i8* %[[V5]] to i8** -// CHECK: %[[V7:.*]] = bitcast i8** %[[V1]] to i8* -// CHECK: %[[V8:.*]] = getelementptr inbounds i8, i8* %[[V7]], i64 8 -// CHECK: %[[V9:.*]] = bitcast i8* %[[V8]] to i8** -// CHECK: call void @__move_assignment_8_8_t0w16_s16(i8** %[[V6]], i8** %[[V9]]) +// CHECK: define linkonce_odr hidden void @__move_assignment_8_8_s0_S_t8w16_s24(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V2:.*]] = load ptr, ptr %[[V1]], align 8 +// CHECK: store ptr null, ptr %[[V1]], align 8 +// CHECK: %[[V3:.*]] = load ptr, ptr %[[V0]], align 8 +// CHECK: store ptr %[[V2]], ptr %[[V0]], align 8 +// CHECK: call void @llvm.objc.release(ptr %[[V3]]) +// CHECK: %[[V5:.*]] = getelementptr inbounds i8, ptr %[[V0]], i64 8 +// CHECK: %[[V8:.*]] = getelementptr inbounds i8, ptr %[[V1]], i64 8 +// CHECK: call void @__move_assignment_8_8_t0w16_s16(ptr %[[V5]], ptr %[[V8]]) void test_move_assignment_StrongOuter2(StrongOuter2 *p) { *p = getStrongOuter2(); @@ -431,10 +365,8 @@ void test_move_assignment_StrongOuter2(StrongOuter2 *p) { // CHECK: define{{.*}} void @test_parameter_StrongSmall([2 x i64] %[[A_COERCE:.*]]) // CHECK: %[[A:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to [2 x i64]* -// CHECK: store [2 x i64] %[[A_COERCE]], [2 x i64]* %[[V0]], align 8 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V1]]) +// CHECK: store [2 x i64] %[[A_COERCE]], ptr %[[A]], align 8 +// CHECK: call void @__destructor_8_s8(ptr %[[A]]) // CHECK: ret void void test_parameter_StrongSmall(StrongSmall a) { @@ -443,16 +375,11 @@ void test_parameter_StrongSmall(StrongSmall a) { // CHECK: define{{.*}} void @test_argument_StrongSmall([2 x i64] %[[A_COERCE:.*]]) // CHECK: %[[A:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[TEMP_LVALUE:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to [2 x i64]* -// CHECK: store [2 x i64] %[[A_COERCE]], [2 x i64]* %[[V0]], align 8 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TEMP_LVALUE]] to i8** -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to i8** -// CHECK: call void @__copy_constructor_8_8_t0w4_s8(i8** %[[V1]], i8** %[[V2]]) -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TEMP_LVALUE]] to [2 x i64]* -// CHECK: %[[V4:.*]] = load [2 x i64], [2 x i64]* %[[V3]], align 8 +// CHECK: store [2 x i64] %[[A_COERCE]], ptr %[[A]], align 8 +// CHECK: call void @__copy_constructor_8_8_t0w4_s8(ptr %[[TEMP_LVALUE]], ptr %[[A]]) +// CHECK: %[[V4:.*]] = load [2 x i64], ptr %[[TEMP_LVALUE]], align 8 // CHECK: call void @calleeStrongSmall([2 x i64] %[[V4]]) -// CHECK: %[[V5:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V5]]) +// CHECK: call void @__destructor_8_s8(ptr %[[A]]) // CHECK: ret void void test_argument_StrongSmall(StrongSmall a) { @@ -462,15 +389,10 @@ void test_argument_StrongSmall(StrongSmall a) { // CHECK: define{{.*}} [2 x i64] @test_return_StrongSmall([2 x i64] %[[A_COERCE:.*]]) // CHECK: %[[RETVAL:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[A:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to [2 x i64]* -// CHECK: store [2 x i64] %[[A_COERCE]], [2 x i64]* %[[V0]], align 8 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[RETVAL]] to i8** -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to i8** -// CHECK: call void @__copy_constructor_8_8_t0w4_s8(i8** %[[V1]], i8** %[[V2]]) -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[A]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V3]]) -// CHECK: %[[V4:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[RETVAL]] to [2 x i64]* -// CHECK: %[[V5:.*]] = load [2 x i64], [2 x i64]* %[[V4]], align 8 +// CHECK: store [2 x i64] %[[A_COERCE]], ptr %[[A]], align 8 +// CHECK: call void @__copy_constructor_8_8_t0w4_s8(ptr %[[RETVAL]], ptr %[[A]]) +// CHECK: call void @__destructor_8_s8(ptr %[[A]]) +// CHECK: %[[V5:.*]] = load [2 x i64], ptr %[[RETVAL]], align 8 // CHECK: ret [2 x i64] %[[V5]] StrongSmall test_return_StrongSmall(StrongSmall a) { @@ -480,23 +402,19 @@ StrongSmall test_return_StrongSmall(StrongSmall a) { // CHECK: define{{.*}} void @test_destructor_ignored_result() // CHECK: %[[COERCE:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[CALL:.*]] = call [2 x i64] @getStrongSmall() -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[COERCE]] to [2 x i64]* -// CHECK: store [2 x i64] %[[CALL]], [2 x i64]* %[[V0]], align 8 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[COERCE]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V1]]) +// CHECK: store [2 x i64] %[[CALL]], ptr %[[COERCE]], align 8 +// CHECK: call void @__destructor_8_s8(ptr %[[COERCE]]) // CHECK: ret void void test_destructor_ignored_result(void) { getStrongSmall(); } -// CHECK: define{{.*}} void @test_destructor_ignored_result2(%{{.*}}* noundef %[[C:.*]]) +// CHECK: define{{.*}} void @test_destructor_ignored_result2(ptr noundef %[[C:.*]]) // CHECK: %[[TMP:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[CALL:.*]] = call [2 x i64]{{.*}}@objc_msgSend -// CHECK: %[[V5:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to [2 x i64]* -// CHECK: store [2 x i64] %[[CALL]], [2 x i64]* %[[V5]], align 8 -// CHECK: %[[V6:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V6]]) +// CHECK: store [2 x i64] %[[CALL]], ptr %[[TMP]], align 8 +// CHECK: call void @__destructor_8_s8(ptr %[[TMP]]) void test_destructor_ignored_result2(C *c) { [c getStrongSmall]; @@ -507,37 +425,37 @@ void test_destructor_ignored_result2(C *c) { // CHECK: call void @__destructor_8_sb0( // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_sb0(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = load i8*, i8** %[[V1]], align 8 -// CHECK: %[[V3:.*]] = call i8* @llvm.objc.retainBlock(i8* %[[V2]]) -// CHECK: store i8* %[[V3]], i8** %[[V0]], align 8 +// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_sb0(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V2:.*]] = load ptr, ptr %[[V1]], align 8 +// CHECK: %[[V3:.*]] = call ptr @llvm.objc.retainBlock(ptr %[[V2]]) +// CHECK: store ptr %[[V3]], ptr %[[V0]], align 8 // CHECK: ret void void test_copy_constructor_StrongBlock(StrongBlock *s) { StrongBlock t = *s; } -// CHECK: define{{.*}} void @test_copy_assignment_StrongBlock(%[[STRUCT_STRONGBLOCK]]* noundef %[[D:.*]], %[[STRUCT_STRONGBLOCK]]* noundef %[[S:.*]]) +// CHECK: define{{.*}} void @test_copy_assignment_StrongBlock(ptr noundef %[[D:.*]], ptr noundef %[[S:.*]]) // CHECK: call void @__copy_assignment_8_8_sb0( -// CHECK: define linkonce_odr hidden void @__copy_assignment_8_8_sb0(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = load i8*, i8** %[[V1]], align 8 -// CHECK: %[[V3:.*]] = call i8* @llvm.objc.retainBlock(i8* %[[V2]]) -// CHECK: %[[V4:.*]] = load i8*, i8** %[[V0]], align 8 -// CHECK: store i8* %[[V3]], i8** %[[V0]], align 8 -// CHECK: call void @llvm.objc.release(i8* %[[V4]]) +// CHECK: define linkonce_odr hidden void @__copy_assignment_8_8_sb0(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V2:.*]] = load ptr, ptr %[[V1]], align 8 +// CHECK: %[[V3:.*]] = call ptr @llvm.objc.retainBlock(ptr %[[V2]]) +// CHECK: %[[V4:.*]] = load ptr, ptr %[[V0]], align 8 +// CHECK: store ptr %[[V3]], ptr %[[V0]], align 8 +// CHECK: call void @llvm.objc.release(ptr %[[V4]]) // CHECK: ret void void test_copy_assignment_StrongBlock(StrongBlock *d, StrongBlock *s) { @@ -548,15 +466,13 @@ void test_copy_assignment_StrongBlock(StrongBlock *d, StrongBlock *s) { // CHECK: call void @__copy_assignment_8_8_AB0s1n2_tv0w8_AE_S_sv8_AB16s4n16_tv128w32_AE( // CHECK-LABEL: define linkonce_odr hidden void @__copy_assignment_8_8_AB0s1n2_tv0w8_AE_S_sv8_AB16s4n16_tv128w32_AE( -// CHECK: %[[ADDR_CUR:.*]] = phi i8** -// CHECK: %[[ADDR_CUR1:.*]] = phi i8** +// CHECK: %[[ADDR_CUR:.*]] = phi ptr +// CHECK: %[[ADDR_CUR1:.*]] = phi ptr -// CHECK: %[[V4:.*]] = bitcast i8** %[[ADDR_CUR]] to i8* -// CHECK: %[[V5:.*]] = bitcast i8** %[[ADDR_CUR1]] to i8* -// CHECK: %[[V6:.*]] = load volatile i8, i8* %[[V5]], align 1 +// CHECK: %[[V6:.*]] = load volatile i8, ptr %[[ADDR_CUR1]], align 1 // CHECK: %[[TOBOOL:.*]] = trunc i8 %[[V6]] to i1 // CHECK: %[[FROMBOOL:.*]] = zext i1 %[[TOBOOL]] to i8 -// CHECK: store volatile i8 %[[FROMBOOL]], i8* %[[V4]], align 1 +// CHECK: store volatile i8 %[[FROMBOOL]], ptr %[[ADDR_CUR]], align 1 void test_copy_assignment_StructWithBool(StructWithBool *d, StructWithBool *s) { *d = *s; @@ -569,9 +485,9 @@ void test_copy_assignment_StructWithBool(StructWithBool *d, StructWithBool *s) { // CHECK-NOT: call // CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_t0w4_sv8( -// CHECK: %[[V8:.*]] = load volatile i8*, i8** %{{.*}}, align 8 -// CHECK: %[[V9:.*]] = call i8* @llvm.objc.retain(i8* %[[V8]]) -// CHECK: store volatile i8* %[[V9]], i8** %{{.*}}, align 8 +// CHECK: %[[V8:.*]] = load volatile ptr, ptr %{{.*}}, align 8 +// CHECK: %[[V9:.*]] = call ptr @llvm.objc.retain(ptr %[[V8]]) +// CHECK: store volatile ptr %[[V9]], ptr %{{.*}}, align 8 void test_copy_constructor_StrongVolatile0(StrongVolatile *s) { StrongVolatile t = *s; @@ -591,7 +507,7 @@ void test_copy_constructor_StrongVolatile1(Strong *s) { // CHECK: call void @__destructor_8_s16( // CHECK: ret void -// CHECK: define linkonce_odr hidden void @__copy_helper_block_8_32n13_8_8_t0w16_s16(i8* noundef %0, i8* noundef %1) +// CHECK: define linkonce_odr hidden void @__copy_helper_block_8_32n13_8_8_t0w16_s16(ptr noundef %0, ptr noundef %1) // CHECK: call void @__copy_constructor_8_8_t0w16_s16( // CHECK: ret void @@ -606,37 +522,31 @@ void test_block_capture_Strong(void) { // CHECK: define{{.*}} void @test_variable_length_array(i32 noundef %[[N:.*]]) // CHECK: %[[N_ADDR:.*]] = alloca i32, align 4 -// CHECK: store i32 %[[N]], i32* %[[N_ADDR]], align 4 -// CHECK: %[[V0:.*]] = load i32, i32* %[[N_ADDR]], align 4 +// CHECK: store i32 %[[N]], ptr %[[N_ADDR]], align 4 +// CHECK: %[[V0:.*]] = load i32, ptr %[[N_ADDR]], align 4 // CHECK: %[[V1:.*]] = zext i32 %[[V0]] to i64 // CHECK: %[[VLA:.*]] = alloca %[[STRUCT_STRONG]], i64 %[[V1]], align 8 -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONG]]* %[[VLA]] to i8** // CHECK: %[[V4:.*]] = mul nuw i64 24, %[[V1]] -// CHECK: %[[V5:.*]] = bitcast i8** %[[V3]] to i8* -// CHECK: %[[V6:.*]] = getelementptr inbounds i8, i8* %[[V5]], i64 %[[V4]] -// CHECK: %[[DSTARRAY_END:.*]] = bitcast i8* %[[V6]] to i8** +// CHECK: %[[V6:.*]] = getelementptr inbounds i8, ptr %[[VLA]], i64 %[[V4]] // CHECK: br label -// CHECK: %[[DSTADDR_CUR:.*]] = phi i8** [ %[[V3]], {{.*}} ], [ %[[V7:.*]], {{.*}} ] -// CHECK: %[[DONE:.*]] = icmp eq i8** %[[DSTADDR_CUR]], %[[DSTARRAY_END]] +// CHECK: %[[DSTADDR_CUR:.*]] = phi ptr [ %[[VLA]], {{.*}} ], [ %[[V7:.*]], {{.*}} ] +// CHECK: %[[DONE:.*]] = icmp eq ptr %[[DSTADDR_CUR]], %[[V6]] // CHECK: br i1 %[[DONE]], label -// CHECK: call void @__default_constructor_8_s16(i8** %[[DSTADDR_CUR]]) -// CHECK: %[[V8:.*]] = bitcast i8** %[[DSTADDR_CUR]] to i8* -// CHECK: %[[V9:.*]] = getelementptr inbounds i8, i8* %[[V8]], i64 24 -// CHECK: %[[V7]] = bitcast i8* %[[V9]] to i8** +// CHECK: call void @__default_constructor_8_s16(ptr %[[DSTADDR_CUR]]) +// CHECK: %[[V9:.*]] = getelementptr inbounds i8, ptr %[[DSTADDR_CUR]], i64 24 // CHECK: br label -// CHECK: call void @func(%[[STRUCT_STRONG]]* noundef %[[VLA]]) -// CHECK: %[[V10:.*]] = getelementptr inbounds %[[STRUCT_STRONG]], %[[STRUCT_STRONG]]* %[[VLA]], i64 %[[V1]] -// CHECK: %[[ARRAYDESTROY_ISEMPTY:.*]] = icmp eq %[[STRUCT_STRONG]]* %[[VLA]], %[[V10]] +// CHECK: call void @func(ptr noundef %[[VLA]]) +// CHECK: %[[V10:.*]] = getelementptr inbounds %[[STRUCT_STRONG]], ptr %[[VLA]], i64 %[[V1]] +// CHECK: %[[ARRAYDESTROY_ISEMPTY:.*]] = icmp eq ptr %[[VLA]], %[[V10]] // CHECK: br i1 %[[ARRAYDESTROY_ISEMPTY]], label -// CHECK: %[[ARRAYDESTROY_ELEMENTPAST:.*]] = phi %[[STRUCT_STRONG]]* [ %[[V10]], {{.*}} ], [ %[[ARRAYDESTROY_ELEMENT:.*]], {{.*}} ] -// CHECK: %[[ARRAYDESTROY_ELEMENT]] = getelementptr inbounds %[[STRUCT_STRONG]], %[[STRUCT_STRONG]]* %[[ARRAYDESTROY_ELEMENTPAST]], i64 -1 -// CHECK: %[[V11:.*]] = bitcast %[[STRUCT_STRONG]]* %[[ARRAYDESTROY_ELEMENT]] to i8** -// CHECK: call void @__destructor_8_s16(i8** %[[V11]]) -// CHECK: %[[ARRAYDESTROY_DONE:.*]] = icmp eq %[[STRUCT_STRONG]]* %[[ARRAYDESTROY_ELEMENT]], %[[VLA]] +// CHECK: %[[ARRAYDESTROY_ELEMENTPAST:.*]] = phi ptr [ %[[V10]], {{.*}} ], [ %[[ARRAYDESTROY_ELEMENT:.*]], {{.*}} ] +// CHECK: %[[ARRAYDESTROY_ELEMENT]] = getelementptr inbounds %[[STRUCT_STRONG]], ptr %[[ARRAYDESTROY_ELEMENTPAST]], i64 -1 +// CHECK: call void @__destructor_8_s16(ptr %[[ARRAYDESTROY_ELEMENT]]) +// CHECK: %[[ARRAYDESTROY_DONE:.*]] = icmp eq ptr %[[ARRAYDESTROY_ELEMENT]], %[[VLA]] // CHECK: br i1 %[[ARRAYDESTROY_DONE]], label // CHECK: ret void @@ -647,7 +557,7 @@ void test_variable_length_array(int n) { } // CHECK: define linkonce_odr hidden void @__default_constructor_8_AB8s8n4_s8_AE( -// CHECK: call void @llvm.memset.p0i8.i64(i8* align 8 %{{.*}}, i8 0, i64 32, i1 false) +// CHECK: call void @llvm.memset.p0.i64(ptr align 8 %{{.*}}, i8 0, i64 32, i1 false) void test_constructor_destructor_IDArray(void) { IDArray t; } @@ -659,26 +569,24 @@ void test_constructor_destructor_StructArray(void) { // Test that StructArray's field 'd' is copied before entering the loop. -// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_t0w8_AB8s24n4_S_t8w16_s24_AE(i8** noundef %[[DST:.*]], i8** noundef %[[SRC:.*]]) +// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_t0w8_AB8s24n4_S_t8w16_s24_AE(ptr noundef %[[DST:.*]], ptr noundef %[[SRC:.*]]) // CHECK: entry: -// CHECK: %[[DST_ADDR:.*]] = alloca i8**, align 8 -// CHECK: %[[SRC_ADDR:.*]] = alloca i8**, align 8 -// CHECK: store i8** %[[DST]], i8*** %[[DST_ADDR]], align 8 -// CHECK: store i8** %[[SRC]], i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V0:.*]] = load i8**, i8*** %[[DST_ADDR]], align 8 -// CHECK: %[[V1:.*]] = load i8**, i8*** %[[SRC_ADDR]], align 8 -// CHECK: %[[V2:.*]] = bitcast i8** %[[V0]] to i64* -// CHECK: %[[V3:.*]] = bitcast i8** %[[V1]] to i64* -// CHECK: %[[V4:.*]] = load i64, i64* %[[V3]], align 8 -// CHECK: store i64 %[[V4]], i64* %[[V2]], align 8 - -// CHECK: phi i8** -// CHECK: phi i8** - -// CHECK: phi i8** -// CHECK: phi i8** - -// CHECK-NOT: load i64, i64* % +// CHECK: %[[DST_ADDR:.*]] = alloca ptr, align 8 +// CHECK: %[[SRC_ADDR:.*]] = alloca ptr, align 8 +// CHECK: store ptr %[[DST]], ptr %[[DST_ADDR]], align 8 +// CHECK: store ptr %[[SRC]], ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V0:.*]] = load ptr, ptr %[[DST_ADDR]], align 8 +// CHECK: %[[V1:.*]] = load ptr, ptr %[[SRC_ADDR]], align 8 +// CHECK: %[[V4:.*]] = load i64, ptr %[[V1]], align 8 +// CHECK: store i64 %[[V4]], ptr %[[V0]], align 8 + +// CHECK: phi ptr +// CHECK: phi ptr + +// CHECK: phi ptr +// CHECK: phi ptr + +// CHECK-NOT: load i64, ptr % // CHECK-NOT: store i64 % // CHECK: call void @__copy_constructor_8_8_t0w16_s16( @@ -691,16 +599,10 @@ void test_copy_constructor_StructArray(StructArray a) { // CHECK: define{{.*}} void @test_copy_constructor_Bitfield0( // CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_s0_t8w2( -// CHECK: %[[V4:.*]] = bitcast i8** %{{.*}} to i8* -// CHECK: %[[V5:.*]] = getelementptr inbounds i8, i8* %[[V4]], i64 8 -// CHECK: %[[V6:.*]] = bitcast i8* %[[V5]] to i8** -// CHECK: %[[V7:.*]] = bitcast i8** %{{.*}} to i8* -// CHECK: %[[V8:.*]] = getelementptr inbounds i8, i8* %[[V7]], i64 8 -// CHECK: %[[V9:.*]] = bitcast i8* %[[V8]] to i8** -// CHECK: %[[V10:.*]] = bitcast i8** %[[V6]] to i16* -// CHECK: %[[V11:.*]] = bitcast i8** %[[V9]] to i16* -// CHECK: %[[V12:.*]] = load i16, i16* %[[V11]], align 8 -// CHECK: store i16 %[[V12]], i16* %[[V10]], align 8 +// CHECK: %[[V5:.*]] = getelementptr inbounds i8, ptr %{{.*}}, i64 8 +// CHECK: %[[V8:.*]] = getelementptr inbounds i8, ptr %{{.*}}, i64 8 +// CHECK: %[[V12:.*]] = load i16, ptr %[[V8]], align 8 +// CHECK: store i16 %[[V12]], ptr %[[V5]], align 8 // CHECK: ret void void test_copy_constructor_Bitfield0(Bitfield0 *a) { @@ -708,33 +610,29 @@ void test_copy_constructor_Bitfield0(Bitfield0 *a) { } // CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_t0w2_s8_t16w4_s24_t32w12_s48_t56w9_tv513w2_tv520w8 -// CHECK: %[[V4:.*]] = load i16, i16* %{{.*}}, align 8 -// CHECK: store i16 %[[V4]], i16* %{{.*}}, align 8 -// CHECK: %[[V21:.*]] = load i32, i32* %{{.*}}, align 8 -// CHECK: store i32 %[[V21]], i32* %{{.*}}, align 8 -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i64 12, i1 false) -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i64 9, i1 false) -// CHECK: %[[V54:.*]] = bitcast i8** %[[V0:.*]] to %[[STRUCT_BITFIELD1]]* -// CHECK: %[[I5:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], %[[STRUCT_BITFIELD1]]* %[[V54]], i32 0, i32 8 -// CHECK: %[[V55:.*]] = bitcast i8** %[[V1:.*]] to %[[STRUCT_BITFIELD1]]* -// CHECK: %[[I51:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], %[[STRUCT_BITFIELD1]]* %[[V55]], i32 0, i32 8 -// CHECK: %[[BF_LOAD:.*]] = load volatile i8, i8* %[[I51]], align 8 +// CHECK: %[[V4:.*]] = load i16, ptr %{{.*}}, align 8 +// CHECK: store i16 %[[V4]], ptr %{{.*}}, align 8 +// CHECK: %[[V21:.*]] = load i32, ptr %{{.*}}, align 8 +// CHECK: store i32 %[[V21]], ptr %{{.*}}, align 8 +// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %{{.*}}, ptr align 8 %{{.*}}, i64 12, i1 false) +// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %{{.*}}, ptr align 8 %{{.*}}, i64 9, i1 false) +// CHECK: %[[I5:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], ptr %[[V0:.*]], i32 0, i32 8 +// CHECK: %[[I51:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], ptr %[[V1:.*]], i32 0, i32 8 +// CHECK: %[[BF_LOAD:.*]] = load volatile i8, ptr %[[I51]], align 8 // CHECK: %[[BF_SHL:.*]] = shl i8 %[[BF_LOAD]], 5 // CHECK: %[[BF_ASHR:.*]] = ashr i8 %[[BF_SHL]], 6 // CHECK: %[[BF_CAST:.*]] = sext i8 %[[BF_ASHR]] to i32 // CHECK: %[[V56:.*]] = trunc i32 %[[BF_CAST]] to i8 -// CHECK: %[[BF_LOAD2:.*]] = load volatile i8, i8* %[[I5]], align 8 +// CHECK: %[[BF_LOAD2:.*]] = load volatile i8, ptr %[[I5]], align 8 // CHECK: %[[BF_VALUE:.*]] = and i8 %[[V56]], 3 // CHECK: %[[BF_SHL3:.*]] = shl i8 %[[BF_VALUE]], 1 // CHECK: %[[BF_CLEAR:.*]] = and i8 %[[BF_LOAD2]], -7 // CHECK: %[[BF_SET:.*]] = or i8 %[[BF_CLEAR]], %[[BF_SHL3]] -// CHECK: store volatile i8 %[[BF_SET]], i8* %[[I5]], align 8 -// CHECK: %[[V57:.*]] = bitcast i8** %[[V0]] to %[[STRUCT_BITFIELD1]]* -// CHECK: %[[I6:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], %[[STRUCT_BITFIELD1]]* %[[V57]], i32 0, i32 9 -// CHECK: %[[V58:.*]] = bitcast i8** %[[V1]] to %[[STRUCT_BITFIELD1]]* -// CHECK: %[[I64:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], %[[STRUCT_BITFIELD1]]* %[[V58]], i32 0, i32 9 -// CHECK: %[[V59:.*]] = load volatile i8, i8* %[[I64]], align 1 -// CHECK: store volatile i8 %[[V59]], i8* %[[I6]], align 1 +// CHECK: store volatile i8 %[[BF_SET]], ptr %[[I5]], align 8 +// CHECK: %[[I6:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], ptr %[[V0]], i32 0, i32 9 +// CHECK: %[[I64:.*]] = getelementptr inbounds %[[STRUCT_BITFIELD1]], ptr %[[V1]], i32 0, i32 9 +// CHECK: %[[V59:.*]] = load volatile i8, ptr %[[I64]], align 1 +// CHECK: store volatile i8 %[[V59]], ptr %[[I6]], align 1 void test_copy_constructor_Bitfield1(Bitfield1 *a) { Bitfield1 t = *a; @@ -744,45 +642,41 @@ void test_copy_constructor_Bitfield1(Bitfield1 *a) { // CHECK: call void @__copy_constructor_8_8_s0_AB8s4n16_tv64w32_AE( // CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_s0_AB8s4n16_tv64w32_AE( -// CHECK: %[[ADDR_CUR:.*]] = phi i8** -// CHECK: %[[ADDR_CUR1:.*]] = phi i8** -// CHECK: %[[V12:.*]] = bitcast i8** %[[ADDR_CUR]] to i32* -// CHECK: %[[V13:.*]] = bitcast i8** %[[ADDR_CUR1]] to i32* -// CHECK: %[[V14:.*]] = load volatile i32, i32* %[[V13]], align 4 -// CHECK: store volatile i32 %[[V14]], i32* %[[V12]], align 4 +// CHECK: %[[ADDR_CUR:.*]] = phi ptr +// CHECK: %[[ADDR_CUR1:.*]] = phi ptr +// CHECK: %[[V14:.*]] = load volatile i32, ptr %[[ADDR_CUR1]], align 4 +// CHECK: store volatile i32 %[[V14]], ptr %[[ADDR_CUR]], align 4 void test_copy_constructor_VolatileArray(VolatileArray *a) { VolatileArray t = *a; } // CHECK: define{{.*}} void @test_compound_literal0( -// CHECK: %[[P:.*]] = alloca %[[STRUCT_STRONGSMALL]]*, align 8 +// CHECK: %[[P:.*]] = alloca ptr, align 8 // CHECK: %[[_COMPOUNDLITERAL:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[CLEANUP_COND:.*]] = alloca i1, align 1 // CHECK: %[[_COMPOUNDLITERAL1:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[CLEANUP_COND4:.*]] = alloca i1, align 1 -// CHECK: %[[I:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]], i32 0, i32 0 -// CHECK: store i32 1, i32* %[[I]], align 8 -// CHECK: %[[F1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]], i32 0, i32 1 -// CHECK: store i8* null, i8** %[[F1]], align 8 -// CHECK: store i1 true, i1* %[[CLEANUP_COND]], align 1 +// CHECK: %[[I:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL]], i32 0, i32 0 +// CHECK: store i32 1, ptr %[[I]], align 8 +// CHECK: %[[F1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL]], i32 0, i32 1 +// CHECK: store ptr null, ptr %[[F1]], align 8 +// CHECK: store i1 true, ptr %[[CLEANUP_COND]], align 1 -// CHECK: %[[I2:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]], i32 0, i32 0 -// CHECK: store i32 2, i32* %[[I2]], align 8 -// CHECK: %[[F13:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]], i32 0, i32 1 -// CHECK: store i8* null, i8** %[[F13]], align 8 -// CHECK: store i1 true, i1* %[[CLEANUP_COND4]], align 1 +// CHECK: %[[I2:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL1]], i32 0, i32 0 +// CHECK: store i32 2, ptr %[[I2]], align 8 +// CHECK: %[[F13:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL1]], i32 0, i32 1 +// CHECK: store ptr null, ptr %[[F13]], align 8 +// CHECK: store i1 true, ptr %[[CLEANUP_COND4]], align 1 -// CHECK: %[[COND:.*]] = phi %[[STRUCT_STRONGSMALL]]* [ %[[_COMPOUNDLITERAL]], %{{.*}} ], [ %[[_COMPOUNDLITERAL1]], %{{.*}} ] -// CHECK: store %[[STRUCT_STRONGSMALL]]* %[[COND]], %[[STRUCT_STRONGSMALL]]** %[[P]], align 8 +// CHECK: %[[COND:.*]] = phi ptr [ %[[_COMPOUNDLITERAL]], %{{.*}} ], [ %[[_COMPOUNDLITERAL1]], %{{.*}} ] +// CHECK: store ptr %[[COND]], ptr %[[P]], align 8 // CHECK: call void @func( -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V1]]) +// CHECK: call void @__destructor_8_s8(ptr %[[_COMPOUNDLITERAL1]]) -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V2]]) +// CHECK: call void @__destructor_8_s8(ptr %[[_COMPOUNDLITERAL]]) void test_compound_literal0(int c) { StrongSmall *p = c ? &(StrongSmall){ 1, 0 } : &(StrongSmall){ 2, 0 }; @@ -794,20 +688,19 @@ void test_compound_literal0(int c) { // CHECK: define{{.*}} void @test_compound_literal1( // CHECK: %[[T:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[I:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[T]], i32 0, i32 0 -// CHECK: store i32 1, i32* %[[I]], align 8 -// CHECK: %[[F1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[T]], i32 0, i32 1 -// CHECK: store i8* null, i8** %[[F1]], align 8 +// CHECK: %[[I:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[T]], i32 0, i32 0 +// CHECK: store i32 1, ptr %[[I]], align 8 +// CHECK: %[[F1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[T]], i32 0, i32 1 +// CHECK: store ptr null, ptr %[[F1]], align 8 -// CHECK: %[[I1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[T]], i32 0, i32 0 -// CHECK: store i32 2, i32* %[[I1]], align 8 -// CHECK: %[[F12:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[T]], i32 0, i32 1 -// CHECK: store i8* null, i8** %[[F12]], align 8 +// CHECK: %[[I1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[T]], i32 0, i32 0 +// CHECK: store i32 2, ptr %[[I1]], align 8 +// CHECK: %[[F12:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[T]], i32 0, i32 1 +// CHECK: store ptr null, ptr %[[F12]], align 8 // CHECK: call void @func( // CHECK-NOT: call void -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[T]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V1]]) +// CHECK: call void @__destructor_8_s8(ptr %[[T]]) // CHECK-NOT: call void void test_compound_literal1(int c) { @@ -816,38 +709,32 @@ void test_compound_literal1(int c) { } // CHECK: define{{.*}} void @test_compound_literal2( -// CHECK: %[[P_ADDR:.*]] = alloca %[[STRUCT_STRONGSMALL]]*, align 8 +// CHECK: %[[P_ADDR:.*]] = alloca ptr, align 8 // CHECK: %[[_COMPOUNDLITERAL:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[CLEANUP_COND:.*]] = alloca i1, align 1 // CHECK: %[[_COMPOUNDLITERAL1:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: %[[CLEANUP_COND4:.*]] = alloca i1, align 1 -// CHECK: %[[V0:.*]] = load %[[STRUCT_STRONGSMALL]]*, %[[STRUCT_STRONGSMALL]]** %[[P_ADDR]], align 8 - -// CHECK: %[[I:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]], i32 0, i32 0 -// CHECK: store i32 1, i32* %[[I]], align 8 -// CHECK: %[[F1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]], i32 0, i32 1 -// CHECK: store i8* null, i8** %[[F1]], align 8 -// CHECK: store i1 true, i1* %[[CLEANUP_COND]], align 1 -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[V0]] to i8** -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]] to i8** -// CHECK: call void @__copy_assignment_8_8_t0w4_s8(i8** %[[V2]], i8** %[[V3]]) - -// CHECK: %[[I2:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]], i32 0, i32 0 -// CHECK: store i32 2, i32* %[[I2]], align 8 -// CHECK: %[[F13:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]], i32 0, i32 1 -// CHECK: store i8* null, i8** %[[F13]], align 8 -// CHECK: store i1 true, i1* %[[CLEANUP_COND4]], align 1 -// CHECK: %[[V4:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[V0]] to i8** -// CHECK: %[[V5:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]] to i8** -// CHECK: call void @__copy_assignment_8_8_t0w4_s8(i8** %[[V4]], i8** %[[V5]]) +// CHECK: %[[V0:.*]] = load ptr, ptr %[[P_ADDR]], align 8 + +// CHECK: %[[I:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL]], i32 0, i32 0 +// CHECK: store i32 1, ptr %[[I]], align 8 +// CHECK: %[[F1:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL]], i32 0, i32 1 +// CHECK: store ptr null, ptr %[[F1]], align 8 +// CHECK: store i1 true, ptr %[[CLEANUP_COND]], align 1 +// CHECK: call void @__copy_assignment_8_8_t0w4_s8(ptr %[[V0]], ptr %[[_COMPOUNDLITERAL]]) + +// CHECK: %[[I2:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL1]], i32 0, i32 0 +// CHECK: store i32 2, ptr %[[I2]], align 8 +// CHECK: %[[F13:.*]] = getelementptr inbounds %[[STRUCT_STRONGSMALL]], ptr %[[_COMPOUNDLITERAL1]], i32 0, i32 1 +// CHECK: store ptr null, ptr %[[F13]], align 8 +// CHECK: store i1 true, ptr %[[CLEANUP_COND4]], align 1 +// CHECK: call void @__copy_assignment_8_8_t0w4_s8(ptr %[[V0]], ptr %[[_COMPOUNDLITERAL1]]) // CHECK: call void @func( -// CHECK: %[[V6:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL1]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V6]]) +// CHECK: call void @__destructor_8_s8(ptr %[[_COMPOUNDLITERAL1]]) -// CHECK: %[[V7:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[_COMPOUNDLITERAL]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V7]]) +// CHECK: call void @__destructor_8_s8(ptr %[[_COMPOUNDLITERAL]]) void test_compound_literal2(int c, StrongSmall *p) { *p = c ? (StrongSmall){ 1, 0 } : (StrongSmall){ 2, 0 }; @@ -856,8 +743,7 @@ void test_compound_literal2(int c, StrongSmall *p) { // CHECK: define{{.*}} void @test_member_access( // CHECK: %[[TMP:.*]] = alloca %[[STRUCT_STRONGSMALL]], -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V3]]) +// CHECK: call void @__destructor_8_s8(ptr %[[TMP]]) // CHECK: call void @func( void test_member_access(void) { @@ -865,10 +751,9 @@ void test_member_access(void) { func(0); } -// CHECK: define{{.*}} void @test_member_access2(%{{.*}}* noundef %[[C:.*]]) +// CHECK: define{{.*}} void @test_member_access2(ptr noundef %[[C:.*]]) // CHECK: %[[COERCE:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V8:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[COERCE]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V8]]) +// CHECK: call void @__destructor_8_s8(ptr %[[COERCE]]) // CHECK: call void @func( void test_member_access2(C *c) { @@ -878,8 +763,7 @@ void test_member_access2(C *c) { // CHECK: define{{.*}} void @test_member_access3( // CHECK: %[[COERCE:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V8:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[COERCE]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V8]]) +// CHECK: call void @__destructor_8_s8(ptr %[[COERCE]]) // CHECK: call void @func( void test_member_access3(void) { @@ -889,8 +773,7 @@ void test_member_access3(void) { // CHECK: define{{.*}} void @test_member_access4() // CHECK: %[[COERCE:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V5:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[COERCE]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V5]]) +// CHECK: call void @__destructor_8_s8(ptr %[[COERCE]]) // CHECK: call void @func( void test_member_access4(void) { @@ -900,11 +783,8 @@ void test_member_access4(void) { // CHECK: define{{.*}} void @test_volatile_variable_reference( // CHECK: %[[AGG_TMP_ENSURED:.*]] = alloca %[[STRUCT_STRONGSMALL]], -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[AGG_TMP_ENSURED]] to i8** -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %{{.*}} to i8** -// CHECK: call void @__copy_constructor_8_8_tv0w32_sv8(i8** %[[V1]], i8** %[[V2]]) -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[AGG_TMP_ENSURED]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V3]]) +// CHECK: call void @__copy_constructor_8_8_tv0w32_sv8(ptr %[[AGG_TMP_ENSURED]], ptr %{{.*}}) +// CHECK: call void @__destructor_8_s8(ptr %[[AGG_TMP_ENSURED]]) // CHECK: call void @func( void test_volatile_variable_reference(volatile StrongSmall *a) { @@ -925,43 +805,38 @@ void test_zero_bitfield(void) { a = b; } -// CHECK-LABEL: define{{.*}} i8* @test_conditional0( +// CHECK-LABEL: define{{.*}} ptr @test_conditional0( // CHECK: %[[TMP:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__copy_constructor_8_8_t0w4_s8(i8** %[[V1]], i8** bitcast (%[[STRUCT_STRONGSMALL]]* @g2 to i8**)) +// CHECK: call void @__copy_constructor_8_8_t0w4_s8(ptr %[[TMP]], ptr @g2) -// CHECK: %[[V2:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__copy_constructor_8_8_t0w4_s8(i8** %[[V2]], i8** bitcast (%[[STRUCT_STRONGSMALL]]* @g1 to i8**)) +// CHECK: call void @__copy_constructor_8_8_t0w4_s8(ptr %[[TMP]], ptr @g1) -// CHECK: %[[V5:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V5]]) +// CHECK: call void @__destructor_8_s8(ptr %[[TMP]]) // CHECK: @llvm.objc.autoreleaseReturnValue id test_conditional0(int c) { return (c ? g2 : g1).f1; } -// CHECK-LABEL: define{{.*}} i8* @test_conditional1( +// CHECK-LABEL: define{{.*}} ptr @test_conditional1( // CHECK-NOT: call void @__destructor id test_conditional1(int c) { calleeStrongSmall(c ? g2 : g1); } -// CHECK-LABEL: define{{.*}} i8* @test_assignment0( +// CHECK-LABEL: define{{.*}} ptr @test_assignment0( // CHECK: %[[TMP:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 -// CHECK: call void @__copy_assignment_8_8_t0w4_s8(i8** bitcast (%[[STRUCT_STRONGSMALL]]* @g2 to i8**), i8** bitcast (%[[STRUCT_STRONGSMALL]]* @g1 to i8**)) -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__copy_constructor_8_8_t0w4_s8(i8** %[[V0]], i8** bitcast (%[[STRUCT_STRONGSMALL]]* @g2 to i8**)) -// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[TMP]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V3]]) +// CHECK: call void @__copy_assignment_8_8_t0w4_s8(ptr @g2, ptr @g1) +// CHECK: call void @__copy_constructor_8_8_t0w4_s8(ptr %[[TMP]], ptr @g2) +// CHECK: call void @__destructor_8_s8(ptr %[[TMP]]) id test_assignment0(void) { return (g2 = g1).f1; } -// CHECK-LABEL: define{{.*}} i8* @test_assignment1( +// CHECK-LABEL: define{{.*}} ptr @test_assignment1( // CHECK-NOT: call void @__destructor id test_assignment1(void) { @@ -972,13 +847,11 @@ id test_assignment1(void) { // CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_STRONGSMALL]], align 8 // CHECK: br i1 -// CHECK: %[[V7:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[AGG_TMP]] to [2 x i64]* -// CHECK: %[[V8:.*]] = load [2 x i64], [2 x i64]* %[[V7]], align 8 -// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void ({{.*}}, [2 x i64] %[[V8]]) +// CHECK: %[[V8:.*]] = load [2 x i64], ptr %[[AGG_TMP]], align 8 +// CHECK: call void @objc_msgSend({{.*}}, [2 x i64] %[[V8]]) // CHECK: br -// CHECK: %[[V9:.*]] = bitcast %[[STRUCT_STRONGSMALL]]* %[[AGG_TMP]] to i8** -// CHECK: call void @__destructor_8_s8(i8** %[[V9]]) #4 +// CHECK: call void @__destructor_8_s8(ptr %[[AGG_TMP]]) #4 // CHECK: br void test_null_reveiver(C *c) { diff --git a/clang/test/CodeGenObjC/ubsan-nonnull.m b/clang/test/CodeGenObjC/ubsan-nonnull.m index 34ad4d3..86859d7 100644 --- a/clang/test/CodeGenObjC/ubsan-nonnull.m +++ b/clang/test/CodeGenObjC/ubsan-nonnull.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fsanitize=nonnull-attribute %s -o - -w | FileCheck %s +// RUN: %clang_cc1 -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fsanitize=nonnull-attribute %s -o - -w | FileCheck %s @interface A @@ -13,36 +13,36 @@ @implementation A // CHECK-LABEL: define internal void @"\01-[A one_arg:]" -// CHECK-SAME: i32* noundef nonnull +// CHECK-SAME: ptr noundef nonnull -(void) one_arg: (__attribute__((nonnull)) int *) arg1 {} // CHECK-LABEL: define internal void @"\01-[A varargs:]" -// CHECK-SAME: i32* noundef nonnull +// CHECK-SAME: ptr noundef nonnull -(void) varargs: (__attribute__((nonnull)) int *) arg1, ... {} // CHECK-LABEL: define internal void @"\01+[A clsmethod:]" -// CHECK-SAME: i32* noundef nonnull +// CHECK-SAME: ptr noundef nonnull +(void) clsmethod: (__attribute__((nonnull)) int *) arg1 {} @end // CHECK-LABEL: define{{.*}} void @call_A void call_A(A *a, int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* [[P1:%.*]], null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P1:%.*]], null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nonnull_arg{{.*}} !nosanitize - // CHECK: call void {{.*}} @objc_msgSend {{.*}} ({{.*}}, i32* noundef [[P1]]) + // CHECK: call void @objc_msgSend({{.*}}, ptr noundef [[P1]]) [a one_arg: p]; - // CHECK: [[ICMP:%.*]] = icmp ne i32* [[P2:%.*]], null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P2:%.*]], null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nonnull_arg{{.*}} !nosanitize - // CHECK: call void {{.*}} @objc_msgSend {{.*}} ({{.*}}, i32* noundef [[P2]], {{.*}}) + // CHECK: call void (ptr, ptr, ptr, ...) @objc_msgSend({{.*}}, ptr noundef [[P2]], {{.*}}) [a varargs: p, p]; - // CHECK: [[ICMP:%.*]] = icmp ne i32* [[P3:%.*]], null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P3:%.*]], null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nonnull_arg{{.*}} !nosanitize - // CHECK: call void {{.*}} @objc_msgSend {{.*}} ({{.*}}, i32* noundef [[P3]]) + // CHECK: call void @objc_msgSend({{.*}}, ptr noundef [[P3]]) [A clsmethod: p]; } diff --git a/clang/test/CodeGenObjC/ubsan-nullability.m b/clang/test/CodeGenObjC/ubsan-nullability.m index a438241..cb39958 100644 --- a/clang/test/CodeGenObjC/ubsan-nullability.m +++ b/clang/test/CodeGenObjC/ubsan-nullability.m @@ -1,6 +1,6 @@ // REQUIRES: asserts -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fblocks -fobjc-arc -fsanitize=nullability-arg,nullability-assign,nullability-return -w %s -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -x objective-c++ -emit-llvm -triple x86_64-apple-macosx10.10.0 -fblocks -fobjc-arc -fsanitize=nullability-arg,nullability-assign,nullability-return -w %s -o - | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fblocks -fobjc-arc -fsanitize=nullability-arg,nullability-assign,nullability-return -w %s -o - | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -x objective-c++ -emit-llvm -triple x86_64-apple-macosx10.10.0 -fblocks -fobjc-arc -fsanitize=nullability-arg,nullability-assign,nullability-return -w %s -o - | FileCheck %s // CHECK: [[NONNULL_RV_LOC1:@.*]] = private unnamed_addr global {{.*}} i32 100, i32 6 // CHECK: [[NONNULL_ARG_LOC:@.*]] = private unnamed_addr global {{.*}} i32 204, i32 15 {{.*}} i32 190, i32 23 @@ -16,14 +16,15 @@ #define INULL ((int *)NULL) #define INNULL ((int *_Nonnull)NULL) -// CHECK-LABEL: define{{.*}} i32* @{{.*}}nonnull_retval1 +// CHECK-LABEL: define{{.*}} ptr @{{.*}}nonnull_retval1 #line 100 int *_Nonnull nonnull_retval1(int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* {{.*}}, null, !nosanitize + // CHECK: nullcheck: + // CHECK: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_return{{.*}}[[NONNULL_RV_LOC1]] return p; - // CHECK: ret i32* + // CHECK: ret ptr } #line 190 @@ -32,7 +33,7 @@ void nonnull_arg(int *_Nonnull p) {} // CHECK-LABEL: define{{.*}} void @{{.*}}call_func_with_nonnull_arg #line 200 void call_func_with_nonnull_arg(int *_Nonnull p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* {{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_arg{{.*}}[[NONNULL_ARG_LOC]] nonnull_arg(p); @@ -41,7 +42,7 @@ void call_func_with_nonnull_arg(int *_Nonnull p) { // CHECK-LABEL: define{{.*}} void @{{.*}}nonnull_assign1 #line 300 void nonnull_assign1(int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* {{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_type_mismatch{{.*}}[[NONNULL_ASSIGN1_LOC]] int *_Nonnull local; @@ -51,7 +52,7 @@ void nonnull_assign1(int *p) { // CHECK-LABEL: define{{.*}} void @{{.*}}nonnull_assign2 #line 400 void nonnull_assign2(int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* %{{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr %{{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_type_mismatch{{.*}}[[NONNULL_ASSIGN2_LOC]] int *_Nonnull arr[1]; @@ -65,7 +66,7 @@ struct S1 { // CHECK-LABEL: define{{.*}} void @{{.*}}nonnull_assign3 #line 500 void nonnull_assign3(int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* %{{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr %{{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_type_mismatch{{.*}}[[NONNULL_ASSIGN3_LOC]] // CHECK-NOT: call void @__ubsan_handle_type_mismatch @@ -76,7 +77,7 @@ void nonnull_assign3(int *p) { // CHECK-LABEL: define{{.*}} void @{{.*}}nonnull_init1 #line 600 void nonnull_init1(int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* %{{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr %{{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_type_mismatch{{.*}}[[NONNULL_INIT1_LOC]] int *_Nonnull local = p; @@ -85,37 +86,37 @@ void nonnull_init1(int *p) { // CHECK-LABEL: define{{.*}} void @{{.*}}nonnull_init2 #line 700 void nonnull_init2(int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* %{{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr %{{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_type_mismatch{{.*}}[[NONNULL_INIT2_LOC1]] - // CHECK: [[ICMP:%.*]] = icmp ne i32* %{{.*}}, null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr %{{.*}}, null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_type_mismatch{{.*}}[[NONNULL_INIT2_LOC2]] int *_Nonnull arr[] = {p, p}; } -// CHECK-LABEL: define{{.*}} i32* @{{.*}}nonnull_retval2 +// CHECK-LABEL: define{{.*}} ptr @{{.*}}nonnull_retval2 #line 800 int *_Nonnull nonnull_retval2(int *_Nonnull arg1, //< Test this. int *_Nonnull arg2, //< Test this. int *_Nullable arg3, //< Don't test the rest. int *arg4, int arg5, ...) { - // CHECK: [[ARG1CMP:%.*]] = icmp ne i32* %arg1, null, !nosanitize + // CHECK: [[ARG1CMP:%.*]] = icmp ne ptr %arg1, null, !nosanitize // CHECK-NEXT: [[DO_RV_CHECK_1:%.*]] = and i1 true, [[ARG1CMP]], !nosanitize - // CHECK: [[ARG2CMP:%.*]] = icmp ne i32* %arg2, null, !nosanitize + // CHECK: [[ARG2CMP:%.*]] = icmp ne ptr %arg2, null, !nosanitize // CHECK-NEXT: [[DO_RV_CHECK_2:%.*]] = and i1 [[DO_RV_CHECK_1]], [[ARG2CMP]] - // CHECK: [[SLOC_PTR:%.*]] = load i8*, i8** %return.sloc.ptr - // CHECK-NEXT: [[SLOC_NONNULL:%.*]] = icmp ne i8* [[SLOC_PTR]], null + // CHECK: [[SLOC_PTR:%.*]] = load ptr, ptr %return.sloc.ptr + // CHECK-NEXT: [[SLOC_NONNULL:%.*]] = icmp ne ptr [[SLOC_PTR]], null // CHECK-NEXT: [[DO_RV_CHECK_3:%.*]] = and i1 [[SLOC_NONNULL]], [[DO_RV_CHECK_2]] // CHECK: br i1 [[DO_RV_CHECK_3]], label %[[NULL:.*]], label %[[NONULL:.*]], !nosanitize // CHECK: [[NULL]]: - // CHECK-NEXT: [[ICMP:%.*]] = icmp ne i32* {{.*}}, null, !nosanitize + // CHECK-NEXT: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_return{{.*}}[[NONNULL_RV_LOC2]] return arg1; // CHECK: [[NONULL]]: - // CHECK-NEXT: ret i32* + // CHECK-NEXT: ret ptr } @interface A @@ -125,53 +126,53 @@ int *_Nonnull nonnull_retval2(int *_Nonnull arg1, //< Test this. @implementation A -// CHECK-LABEL: define internal i32* @"\01+[A objc_clsmethod:]" +// CHECK-LABEL: define internal ptr @"\01+[A objc_clsmethod:]" +(int *_Nonnull) objc_clsmethod: (int *_Nonnull) arg1 { - // CHECK: [[ARG1CMP:%.*]] = icmp ne i32* %arg1, null, !nosanitize + // CHECK: [[ARG1CMP:%.*]] = icmp ne ptr %arg1, null, !nosanitize // CHECK-NEXT: [[DO_RV_CHECK:%.*]] = and i1 true, [[ARG1CMP]] - // CHECK: [[SLOC_PTR:%.*]] = load i8*, i8** %return.sloc.ptr - // CHECK-NEXT: [[SLOC_NONNULL:%.*]] = icmp ne i8* [[SLOC_PTR]], null + // CHECK: [[SLOC_PTR:%.*]] = load ptr, ptr %return.sloc.ptr + // CHECK-NEXT: [[SLOC_NONNULL:%.*]] = icmp ne ptr [[SLOC_PTR]], null // CHECK-NEXT: [[DO_RV_CHECK_2:%.*]] = and i1 [[SLOC_NONNULL]], [[DO_RV_CHECK]] // CHECK: br i1 [[DO_RV_CHECK_2]], label %[[NULL:.*]], label %[[NONULL:.*]], !nosanitize // CHECK: [[NULL]]: - // CHECK-NEXT: [[ICMP:%.*]] = icmp ne i32* {{.*}}, null, !nosanitize + // CHECK-NEXT: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_return{{.*}} return arg1; // CHECK: [[NONULL]]: - // CHECK-NEXT: ret i32* + // CHECK-NEXT: ret ptr } -// CHECK-LABEL: define internal i32* @"\01-[A objc_method:]" +// CHECK-LABEL: define internal ptr @"\01-[A objc_method:]" -(int *_Nonnull) objc_method: (int *_Nonnull) arg1 { - // CHECK: [[ARG1CMP:%.*]] = icmp ne i32* %arg1, null, !nosanitize + // CHECK: [[ARG1CMP:%.*]] = icmp ne ptr %arg1, null, !nosanitize // CHECK-NEXT: [[DO_RV_CHECK:%.*]] = and i1 true, [[ARG1CMP]] - // CHECK: [[SLOC_PTR:%.*]] = load i8*, i8** %return.sloc.ptr - // CHECK-NEXT: [[SLOC_NONNULL:%.*]] = icmp ne i8* [[SLOC_PTR]], null + // CHECK: [[SLOC_PTR:%.*]] = load ptr, ptr %return.sloc.ptr + // CHECK-NEXT: [[SLOC_NONNULL:%.*]] = icmp ne ptr [[SLOC_PTR]], null // CHECK-NEXT: [[DO_RV_CHECK_2:%.*]] = and i1 [[SLOC_NONNULL]], [[DO_RV_CHECK]] // CHECK: br i1 [[DO_RV_CHECK_2]], label %[[NULL:.*]], label %[[NONULL:.*]], !nosanitize // CHECK: [[NULL]]: - // CHECK-NEXT: [[ICMP:%.*]] = icmp ne i32* {{.*}}, null, !nosanitize + // CHECK-NEXT: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_return{{.*}} return arg1; // CHECK: [[NONULL]]: - // CHECK-NEXT: ret i32* + // CHECK-NEXT: ret ptr } @end // CHECK-LABEL: define{{.*}} void @{{.*}}call_A void call_A(A *a, int *p) { - // CHECK: [[ICMP:%.*]] = icmp ne i32* [[P1:%.*]], null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P1:%.*]], null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_arg{{.*}} !nosanitize - // CHECK: call i32* {{.*}} @objc_msgSend to i32* {{.*}}({{.*}}, i32* [[P1]]) + // CHECK: call ptr @objc_msgSend({{.*}}, ptr [[P1]]) [a objc_method: p]; - // CHECK: [[ICMP:%.*]] = icmp ne i32* [[P2:%.*]], null, !nosanitize + // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P2:%.*]], null, !nosanitize // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_nullability_arg{{.*}} !nosanitize - // CHECK: call i32* {{.*}} @objc_msgSend to i32* {{.*}}({{.*}}, i32* [[P2]]) + // CHECK: call ptr @objc_msgSend({{.*}}, ptr [[P2]]) [A objc_clsmethod: p]; } -- 2.7.4