1; RUN: opt -objc-arc -S < %s | FileCheck %s 2 3declare void @alterRefCount() 4declare void @use(i8*) 5 6; Check that ARC optimizer doesn't reverse the order of the retain call and the 7; release call when there are debug instructions. 8 9; CHECK: call i8* @llvm.objc.retain(i8* %x) 10; CHECK: call void @llvm.objc.release(i8* %x) 11 12define i32 @test(i8* %x, i8* %y, i8 %z, i32 %i) { 13 %i.addr = alloca i32, align 4 14 store i32 %i, i32* %i.addr, align 4 15 %v1 = tail call i8* @llvm.objc.retain(i8* %x) 16 store i8 %z, i8* %x 17 call void @llvm.dbg.declare(metadata i32* %i.addr, metadata !9, metadata !DIExpression()), !dbg !10 18 call void @alterRefCount() 19 tail call void @llvm.objc.release(i8* %x) 20 ret i32 %i 21} 22 23declare void @llvm.dbg.declare(metadata, metadata, metadata) 24declare i8* @llvm.objc.retain(i8*) local_unnamed_addr 25declare void @llvm.objc.release(i8*) local_unnamed_addr 26 27!llvm.module.flags = !{!0, !1} 28 29!0 = !{i32 2, !"Dwarf Version", i32 4} 30!1 = !{i32 2, !"Debug Info Version", i32 3} 31!2 = !DILocalVariable(name: "i", arg: 1, scope: !3, file: !4, line: 1, type: !7) 32!3 = distinct !DISubprogram(name: "test", scope: !4, file: !4, line: 1, type: !5, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !8, retainedNodes: !9) 33!4 = !DIFile(filename: "test.m", directory: "dir") 34!5 = !DISubroutineType(types: !6) 35!6 = !{!7, !7} 36!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 37!8 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !4, isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, enums: !9, nameTableKind: None) 38!9 = !{} 39!10 = !DILocation(line: 1, column: 14, scope: !3) 40