1 ; RUN: opt -S < %s -objc-arc-expand -objc-arc-contract | FileCheck %s
2 ; Don't crash. Reproducer for a use_iterator bug from r203364.
3 ; rdar://problem/16333235
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-darwin13.2.0"
7 %struct = type { i8*, i8* }
9 ; CHECK-LABEL: @foo() {
10 define internal i8* @foo() {
12 %call = call i8* @bar()
13 ; CHECK: %retained1 = call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %call)
14 %retained1 = call i8* @llvm.objc.retain(i8* %call)
15 %isnull = icmp eq i8* %retained1, null
16 br i1 %isnull, label %cleanup, label %if.end
19 ; CHECK: %retained2 = call i8* @llvm.objc.retain(i8* %retained1)
20 %retained2 = call i8* @llvm.objc.retain(i8* %retained1)
24 %retval = phi i8* [ %retained2, %if.end ], [ null, %entry ]
30 declare extern_weak i8* @llvm.objc.retain(i8*)