Update debug info test cases with empty SplitDebugFilename field.
[oota-llvm.git] / test / Transforms / ObjCARC / dont-infinite-loop-during-block-escape-analysis.ll
1 ; RUN: opt -S -objc-arc < %s
2 ; bugzilla://14551
3 ; rdar://12851911
4
5 ; Make sure that we do not hang clang during escape analysis.
6
7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
8 target triple = "x86_64-darwin"
9
10 %struct.__block_descriptor = type { i64, i64 }
11 %struct.__block_byref_foo = type { i8*, %struct.__block_byref_foo*, i32, i32, i32 }
12
13 @_NSConcreteGlobalBlock = external global i8*
14 @.str = private unnamed_addr constant [6 x i8] c"v8@?0\00", align 1
15 @__block_descriptor_tmp = internal constant { i64, i64, i8*, i8* } { i64 0, i64 32, i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i8* null }
16 @__block_literal_global = internal constant { i8**, i32, i32, i8*, %struct.__block_descriptor* } { i8** @_NSConcreteGlobalBlock, i32 1342177280, i32 0, i8* bitcast (void (i8*)* @__hang_clang_block_invoke to i8*), %struct.__block_descriptor* bitcast ({ i64, i64, i8*, i8* }* @__block_descriptor_tmp to %struct.__block_descriptor*) }, align 8
17
18 define void @hang_clang() uwtable optsize ssp {
19 entry:
20   %foo = alloca %struct.__block_byref_foo, align 8
21   %byref.isa = getelementptr inbounds %struct.__block_byref_foo* %foo, i64 0, i32 0
22   store i8* null, i8** %byref.isa, align 8
23   %byref.forwarding = getelementptr inbounds %struct.__block_byref_foo* %foo, i64 0, i32 1
24   store %struct.__block_byref_foo* %foo, %struct.__block_byref_foo** %byref.forwarding, align 8
25   %byref.flags = getelementptr inbounds %struct.__block_byref_foo* %foo, i64 0, i32 2
26   store i32 536870912, i32* %byref.flags, align 8
27   %byref.size = getelementptr inbounds %struct.__block_byref_foo* %foo, i64 0, i32 3
28   store i32 32, i32* %byref.size, align 4
29   %foo1 = getelementptr inbounds %struct.__block_byref_foo* %foo, i64 0, i32 4
30   store i32 0, i32* %foo1, align 8, !tbaa !4
31   br label %for.body
32
33 for.body:                                         ; preds = %for.inc.for.body_crit_edge, %entry
34   %0 = phi i1 [ true, %entry ], [ %phitmp, %for.inc.for.body_crit_edge ]
35   %i.06 = phi i32 [ 1, %entry ], [ %phitmp8, %for.inc.for.body_crit_edge ]
36   %block.05 = phi void (...)* [ null, %entry ], [ %block.1, %for.inc.for.body_crit_edge ]
37   br i1 %0, label %for.inc, label %if.then
38
39 if.then:                                          ; preds = %for.body
40   %1 = call i8* @objc_retainBlock(i8* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global to i8*)) nounwind, !clang.arc.copy_on_escape !7
41   %2 = bitcast i8* %1 to void (...)*
42   %3 = bitcast void (...)* %block.05 to i8*
43   call void @objc_release(i8* %3) nounwind, !clang.imprecise_release !7
44   br label %for.inc
45
46 for.inc:                                          ; preds = %for.body, %if.then
47   %block.1 = phi void (...)* [ %2, %if.then ], [ %block.05, %for.body ]
48   %exitcond = icmp eq i32 %i.06, 10
49   br i1 %exitcond, label %for.end, label %for.inc.for.body_crit_edge
50
51 for.inc.for.body_crit_edge:                       ; preds = %for.inc
52   %.pre = load %struct.__block_byref_foo** %byref.forwarding, align 8
53   %foo2.phi.trans.insert = getelementptr inbounds %struct.__block_byref_foo* %.pre, i64 0, i32 4
54   %.pre7 = load i32* %foo2.phi.trans.insert, align 4, !tbaa !4
55   %phitmp = icmp eq i32 %.pre7, 0
56   %phitmp8 = add i32 %i.06, 1
57   br label %for.body
58
59 for.end:                                          ; preds = %for.inc
60   %4 = bitcast %struct.__block_byref_foo* %foo to i8*
61   call void @_Block_object_dispose(i8* %4, i32 8)
62   %5 = bitcast void (...)* %block.1 to i8*
63   call void @objc_release(i8* %5) nounwind, !clang.imprecise_release !7
64   ret void
65 }
66
67 define internal void @__hang_clang_block_invoke(i8* nocapture %.block_descriptor) nounwind uwtable readnone optsize ssp {
68 entry:
69   ret void
70 }
71
72 declare i8* @objc_retainBlock(i8*)
73
74 declare void @objc_release(i8*) nonlazybind
75
76 declare void @_Block_object_dispose(i8*, i32)
77
78 !llvm.module.flags = !{!0, !1, !2, !3}
79
80 !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2}
81 !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0}
82 !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"}
83 !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0}
84 !4 = metadata !{metadata !"int", metadata !5}
85 !5 = metadata !{metadata !"omnipotent char", metadata !6}
86 !6 = metadata !{metadata !"Simple C/C++ TBAA"}
87 !7 = metadata !{}