147 lines · plain
1; Make sure this succeeds without hitting an assertion and the output is deterministic2; RUN: mkdir -p %t3; RUN: opt -passes=objc-arc %s -S -o %t/out1.ll4; RUN: opt -passes=objc-arc %s -S -o %t/out2.ll5; RUN: diff -u %t/out1.ll %t/out2.ll6 7%0 = type opaque8%struct._class_t = type { ptr, ptr, ptr, ptr, ptr }9%struct._objc_cache = type opaque10%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 122@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [25 x i8] c"fileSystemRepresentation\00", section "__TEXT,__objc_methname,cstring_literals", align 123@OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global ptr @OBJC_METH_VAR_NAME_, section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 824@"OBJC_CLASS_$_NSString" = external global %struct._class_t25@"OBJC_CLASSLIST_REFERENCES_$_" = internal global ptr @"OBJC_CLASS_$_NSString", section "__DATA,__objc_classrefs,regular,no_dead_strip", align 826@__CFConstantStringClassReference = external global [0 x i32]27@.str.1 = private unnamed_addr constant [3 x i8] c"%@\00", section "__TEXT,__cstring,cstring_literals", align 128@_unnamed_cfstring_ = private global %struct.__NSConstantString_tag { ptr @__CFConstantStringClassReference, i32 1992, ptr @.str.1, i64 2 }, section "__DATA,__cfstring", align 8 #029@OBJC_METH_VAR_NAME_.2 = private unnamed_addr constant [18 x i8] c"stringWithFormat:\00", section "__TEXT,__objc_methname,cstring_literals", align 130@OBJC_SELECTOR_REFERENCES_.3 = internal externally_initialized global ptr @OBJC_METH_VAR_NAME_.2, section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 831@global1 = external local_unnamed_addr constant ptr, align 832@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 438 %personalized = alloca i32, align 439 %cmp31 = icmp sgt i32 %argc, 140 br i1 %cmp31, label %for.body.lr.ph, label %for.cond.cleanup41 42for.body.lr.ph: ; preds = %entry43 %0 = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 844 %1 = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.3, align 845 br label %for.body46 47for.cond.cleanup.loopexit: ; preds = %if.end1948 br label %for.cond.cleanup49 50for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry51 ret i32 052 53for.body: ; preds = %for.body.lr.ph, %if.end1954 %i.032 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %if.end19 ]55 call void @llvm.lifetime.start.p0(ptr nonnull %persistent) #456 store i32 0, ptr %persistent, align 457 call void @llvm.lifetime.start.p0(ptr nonnull %personalized) #458 store i32 0, ptr %personalized, align 459 %call = call zeroext i1 @lookupType(ptr noundef nonnull %persistent, ptr noundef nonnull %personalized) #8, !clang.arc.no_objc_arc_exceptions !1560 br i1 %call, label %if.then, label %if.end1961 62if.then: ; preds = %for.body63 %2 = load i32, ptr %persistent, align 464 %cmp1.not = icmp eq i32 %2, 065 br i1 %cmp1.not, label %if.end, label %if.then266 67if.then2: ; preds = %if.then68 %call34 = call ptr @getnsstr() #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !1569 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call34) #470 call void @llvm.objc.release(ptr null) #4, !clang.imprecise_release !1571 %call56 = call ptr @getnsstr() #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !1572 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call56) #473 call void @llvm.objc.release(ptr null) #4, !clang.imprecise_release !1574 br label %if.end75 76if.end: ; preds = %if.then2, %if.then77 %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 480 %cmp7.not = icmp eq i32 %3, 081 br i1 %cmp7.not, label %if.end11, label %if.then882 83if.then8: ; preds = %if.end84 %call910 = call ptr @getnsstr() #8 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ], !clang.arc.no_objc_arc_exceptions !1585 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call910) #486 call void @llvm.objc.release(ptr %path.0) #4, !clang.imprecise_release !1587 br label %if.end1188 89if.end11: ; preds = %if.then8, %if.end90 %path.1 = phi ptr [ %call910, %if.then8 ], [ %path.0, %if.end ]91 %cmp12.not = icmp eq ptr %path.1, null92 br i1 %cmp12.not, label %if.else, label %if.then1393 94if.then13: ; preds = %if.end1195 %call14 = call ptr @objc_msgSend(ptr noundef nonnull %path.1, ptr noundef %0) #8, !clang.arc.no_objc_arc_exceptions !1596 %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %call14) #8, !clang.arc.no_objc_arc_exceptions !1597 br label %if.end1898 99if.else: ; preds = %if.end11100 %4 = load ptr, ptr @"OBJC_CLASSLIST_REFERENCES_$_", align 8101 %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 !15102 call void (...) @llvm.objc.clang.arc.noop.use(ptr %call1617) #4103 call void @llvm.objc.release(ptr %call1617) #4, !clang.imprecise_release !15104 br label %if.end18105 106if.end18: ; preds = %if.else, %if.then13107 %.pre-phi = phi ptr [ null, %if.else ], [ %path.1, %if.then13 ]108 call void @llvm.objc.release(ptr %name.0) #4, !clang.imprecise_release !15109 call void @llvm.objc.release(ptr %.pre-phi) #4, !clang.imprecise_release !15110 br label %if.end19111 112if.end19: ; preds = %if.end18, %for.body113 call void @llvm.lifetime.end.p0(ptr nonnull %personalized) #4114 call void @llvm.lifetime.end.p0(ptr nonnull %persistent) #4115 %inc = add nuw nsw i32 %i.032, 1116 %exitcond.not = icmp eq i32 %inc, %argc117 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body118}119 120; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn121declare void @llvm.lifetime.start.p0(ptr nocapture) #2122 123; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn124declare void @llvm.lifetime.end.p0(ptr nocapture) #2125 126; Function Attrs: inaccessiblememonly mustprogress nocallback nofree nosync nounwind willreturn127declare void @llvm.objc.clang.arc.noop.use(...) #5128 129declare zeroext i1 @lookupType(ptr noundef, ptr noundef) #2130 131declare ptr @getnsstr(...) #2132 133; Function Attrs: nounwind134declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr) #3135 136; Function Attrs: nounwind137declare void @llvm.objc.release(ptr) #3138 139declare i32 @printf(ptr noundef, ...) #2140 141; Function Attrs: nonlazybind142declare ptr @objc_msgSend(ptr, ptr, ...) #4143 144attributes #0 = { "objc_arc_inert" }145 146!15 = !{}147