1 ; RUN: opt -S < %s -passes=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 { ptr, ptr }
9 ; CHECK-LABEL: @foo() {
10 define internal ptr @foo() {
12 %call = call ptr @bar()
13 ; CHECK: %retained1 = call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call)
14 %retained1 = call ptr @llvm.objc.retain(ptr %call)
15 %isnull = icmp eq ptr %retained1, null
16 br i1 %isnull, label %cleanup, label %if.end
19 ; CHECK: %retained2 = call ptr @llvm.objc.retain(ptr %retained1)
20 %retained2 = call ptr @llvm.objc.retain(ptr %retained1)
24 %retval = phi ptr [ %retained2, %if.end ], [ null, %entry ]
30 declare extern_weak ptr @llvm.objc.retain(ptr)