// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-freebsd -fobjc-arc -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s
typedef struct Big;
// CHECK-LABEL: define{{.*}} void @test_loop_zeroing(
// CHECK: [[P:%.*]] = alloca i8*,
// CHECK: [[BIG:%.*]] = alloca %struct.Big,
// CHECK: br label %for.cond
//
// CHECK: for.cond:
// CHECK-NEXT: [[RECEIVER:%.*]] = load i8*, i8** [[P]],
// CHECK-NEXT: [[ISNIL:%.*]] = icmp eq i8* [[RECEIVER]], null
// CHECK-NEXT: br i1 [[ISNIL]], label %nilReceiverCleanup, label %msgSend
//
// CHECK: msgSend:
// CHECK: @objc_msg_lookup_sender
// CHECK: call void {{%.*}}({{.*}} [[BIG]],
// CHECK: br label %continue
//
// CHECK: nilReceiverCleanup:
// CHECK-NEXT: [[T0:%.*]] = bitcast %struct.Big* [[BIG]] to i8*
// CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[T0]], i8 0, i64 48, i1 false)
// CHECK-NEXT: br label %continue
//
// CHECK: continue:
// CHECK-NEXT: br label %for.cond
void
// CHECK-LABEL: define{{.*}} void @test_zeroing_and_consume(
// CHECK: [[P:%.*]] = alloca i8*,
// CHECK: [[Q:%.*]] = alloca i8*,
// CHECK: [[BIG:%.*]] = alloca %struct.Big,
// CHECK: br label %for.cond
//
// CHECK: for.cond:
// CHECK-NEXT: [[RECEIVER:%.*]] = load i8*, i8** [[P]],
// CHECK-NEXT: [[Q_LOAD:%.*]] = load i8*, i8** [[Q]],
// CHECK-NEXT: [[Q_RETAIN:%.*]] = call i8* @llvm.objc.retain(i8* [[Q_LOAD]])
// CHECK-NEXT: [[ISNIL:%.*]] = icmp eq i8* [[RECEIVER]], null
// CHECK-NEXT: br i1 [[ISNIL]], label %nilReceiverCleanup, label %msgSend
//
// CHECK: msgSend:
// CHECK: @objc_msg_lookup_sender
// CHECK: call void {{%.*}}({{.*}} [[BIG]],
// CHECK: br label %continue
//
// CHECK: nilReceiverCleanup:
// CHECK-NEXT: call void @llvm.objc.release(i8* [[Q_RETAIN]])
// CHECK-NEXT: [[T0:%.*]] = bitcast %struct.Big* [[BIG]] to i8*
// CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[T0]], i8 0, i64 48, i1 false)
// CHECK-NEXT: br label %continue
//
// CHECK: continue:
// CHECK-NEXT: br label %for.cond
void
// CHECK-LABEL: define{{.*}} void @test_complex(
// CHECK: [[P:%.*]] = alloca i8*,
// CHECK: [[RECEIVER:%.*]] = load i8*, i8** [[P]],
// CHECK-NEXT: [[ISNIL:%.*]] = icmp eq i8* [[RECEIVER]], null
// CHECK-NEXT: br i1 [[ISNIL]], label %continue, label %msgSend
// CHECK: msgSend:
// CHECK: @objc_msg_lookup_sender
// CHECK: br label %continue
// CHECK: continue:
// CHECK-NEXT: phi float
// CHECK-NEXT: phi float
void