1 ; RUN: opt -objc-arc -S < %s | FileCheck %s
3 declare void @alterRefCount()
6 ; Check that ARC optimizer doesn't reverse the order of the retain call and the
7 ; release call when there are debug instructions.
9 ; CHECK: call i8* @llvm.objc.retain(i8* %x)
10 ; CHECK: call void @llvm.objc.release(i8* %x)
12 define 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)
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)
23 declare void @llvm.dbg.declare(metadata, metadata, metadata)
24 declare i8* @llvm.objc.retain(i8*) local_unnamed_addr
25 declare void @llvm.objc.release(i8*) local_unnamed_addr
27 !llvm.module.flags = !{!0, !1}
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)
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)
39 !10 = !DILocation(line: 1, column: 14, scope: !3)