1; Make sure this succeeds without hitting an assertion and the output is deterministic 2; RUN: mkdir -p %t 3; RUN: opt -passes=objc-arc %s -S -o %t/out1.ll 4; RUN: opt -passes=objc-arc %s -S -o %t/out2.ll 5; RUN: diff -u %t/out1.ll %t/out2.ll 6 7%0 = type opaque 8%struct._class_t = type { ptr, ptr, ptr, ptr, ptr } 9%struct._objc_cache = type opaque 10%struct._class_ro_t = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr } 11%struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } 12%struct._objc_method = type { ptr, ptr, ptr } 13%struct._objc_protocol_list = type { i64, [0 x ptr] } 14%struct._protocol_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr } 15%struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } 16%struct._ivar_t = type { ptr, ptr, ptr, i32, i32 } 17%struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } 18%struct._prop_t = type { ptr, ptr } 19%struct.__NSConstantString_tag = type { ptr, i32, ptr, i64 } 20 21@.str = private unnamed_addr constant [8 x i8] c"%s: %s\0A\00", align 1 22@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [25 x i8] c"fileSystemRepresentation\00", section "__TEXT,__objc_methname,cstring_literals", align 1 23@OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global ptr @OBJC_METH_VAR_NAME_, section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 8 24@"OBJC_CLASS_$_NSString" = external global %struct._class_t 25@"OBJC_CLASSLIST_REFERENCES_$_" = internal global ptr @"OBJC_CLASS_$_NSString", section "__DATA,__objc_classrefs,regular,no_dead_strip", align 8 26@__CFConstantStringClassReference = external global [0 x i32] 27@.str.1 = private unnamed_addr constant [3 x i8] c"%@\00", section "__TEXT,__cstring,cstring_literals", align 1 28@_unnamed_cfstring_ = private global %struct.__NSConstantString_tag { ptr @__CFConstantStringClassReference, i32 1992, ptr @.str.1, i64 2 }, section "__DATA,__cfstring", align 8 #0 29@OBJC_METH_VAR_NAME_.2 = private unnamed_addr constant [18 x i8] c"stringWithFormat:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 30@OBJC_SELECTOR_REFERENCES_.3 = internal externally_initialized global ptr @OBJC_METH_VAR_NAME_.2, section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 8 31@global1 = external local_unnamed_addr constant ptr, align 8 32@llvm.compiler.used = appending global [5 x ptr] [ptr @OBJC_METH_VAR_NAME_, ptr @OBJC_SELECTOR_REFERENCES_, ptr @"OBJC_CLASSLIST_REFERENCES_$_", ptr @OBJC_METH_VAR_NAME_.2, ptr @OBJC_SELECTOR_REFERENCES_.3], section "llvm.metadata" 33 34; Function Attrs: optsize ssp uwtable(sync) 35define i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 { 36entry: 37 %persistent = alloca i32, align 4 38 %personalized = alloca i32, align 4 39 %cmp31 = icmp sgt i32 %argc, 1 40 br i1 %cmp31, label %for.body.lr.ph, label %for.cond.cleanup 41 42for.body.lr.ph: ; preds = %entry 43 %0 = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8 44 %1 = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.3, align 8 45 br label %for.body 46 47for.cond.cleanup.loopexit: ; preds = %if.end19 48 br label %for.cond.cleanup 49 50for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry 51 ret i32 0 52 53for.body: ; preds = %for.body.lr.ph, %if.end19 54 %i.032 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %if.end19 ] 55 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %persistent) #4 56 store i32 0, ptr %persistent, align 4 57 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %personalized) #4 58 store i32 0, ptr %personalized, align 4 59 %call = call zeroext i1 @lookupType(ptr noundef nonnull %persistent, ptr noundef nonnull %personalized) #8, !clang.arc.no_objc_arc_exceptions !15 60 br i1 %call, label %if.then, label %if.end19 61 62if.then: ; preds = %for.body 63 %2 = load i32, ptr %persistent, align 4 64 %cmp1.not = icmp eq i32 %2, 0 65 br i1 %cmp1.not, label %if.end, label %if.then2 66 67if.then2: ; preds = %if.then 68 %call34 = call ptr @getnsstr() #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !15 69 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call34) #4 70 call void @llvm.objc.release(ptr null) #4, !clang.imprecise_release !15 71 %call56 = call ptr @getnsstr() #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !15 72 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call56) #4 73 call void @llvm.objc.release(ptr null) #4, !clang.imprecise_release !15 74 br label %if.end 75 76if.end: ; preds = %if.then2, %if.then 77 %path.0 = phi ptr [ %call34, %if.then2 ], [ null, %if.then ] 78 %name.0 = phi ptr [ %call56, %if.then2 ], [ null, %if.then ] 79 %3 = load i32, ptr %personalized, align 4 80 %cmp7.not = icmp eq i32 %3, 0 81 br i1 %cmp7.not, label %if.end11, label %if.then8 82 83if.then8: ; preds = %if.end 84 %call910 = call ptr @getnsstr() #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !15 85 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call910) #4 86 call void @llvm.objc.release(ptr %path.0) #4, !clang.imprecise_release !15 87 br label %if.end11 88 89if.end11: ; preds = %if.then8, %if.end 90 %path.1 = phi ptr [ %call910, %if.then8 ], [ %path.0, %if.end ] 91 %cmp12.not = icmp eq ptr %path.1, null 92 br i1 %cmp12.not, label %if.else, label %if.then13 93 94if.then13: ; preds = %if.end11 95 %call14 = call ptr @objc_msgSend(ptr noundef nonnull %path.1, ptr noundef %0) #8, !clang.arc.no_objc_arc_exceptions !15 96 %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %call14) #8, !clang.arc.no_objc_arc_exceptions !15 97 br label %if.end18 98 99if.else: ; preds = %if.end11 100 %4 = load ptr, ptr @"OBJC_CLASSLIST_REFERENCES_$_", align 8 101 %call1617 = call ptr (ptr, ptr, ptr, ...) @objc_msgSend(ptr noundef %4, ptr noundef %1, ptr noundef nonnull @_unnamed_cfstring_, ptr noundef null) #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !15 102 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call1617) #4 103 call void @llvm.objc.release(ptr %call1617) #4, !clang.imprecise_release !15 104 br label %if.end18 105 106if.end18: ; preds = %if.else, %if.then13 107 %.pre-phi = phi ptr [ null, %if.else ], [ %path.1, %if.then13 ] 108 call void @llvm.objc.release(ptr %name.0) #4, !clang.imprecise_release !15 109 call void @llvm.objc.release(ptr %.pre-phi) #4, !clang.imprecise_release !15 110 br label %if.end19 111 112if.end19: ; preds = %if.end18, %for.body 113 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %personalized) #4 114 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %persistent) #4 115 %inc = add nuw nsw i32 %i.032, 1 116 %exitcond.not = icmp eq i32 %inc, %argc 117 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body 118} 119 120; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn 121declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 122 123; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn 124declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 125 126; Function Attrs: inaccessiblememonly mustprogress nocallback nofree nosync nounwind willreturn 127declare void @llvm.objc.clang.arc.noop.use(...) #5 128 129declare zeroext i1 @lookupType(ptr noundef, ptr noundef) #2 130 131declare ptr @getnsstr(...) #2 132 133; Function Attrs: nounwind 134declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr) #3 135 136; Function Attrs: nounwind 137declare void @llvm.objc.release(ptr) #3 138 139declare i32 @printf(ptr noundef, ...) #2 140 141; Function Attrs: nonlazybind 142declare ptr @objc_msgSend(ptr, ptr, ...) #4 143 144attributes #0 = { "objc_arc_inert" } 145 146!15 = !{} 147