DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable
[oota-llvm.git] / test / Transforms / DeadArgElim / 2010-04-30-DbgInfo.ll
1 ; RUN: opt -S -deadargelim < %s | FileCheck %s
2
3 @.str = private constant [1 x i8] zeroinitializer, align 1 ; <[1 x i8]*> [#uses=1]
4
5 define i8* @vfs_addname(i8* %name, i32 %len, i32 %hash, i32 %flags) nounwind ssp {
6 entry:
7   call void @llvm.dbg.value(metadata i8* %name, i64 0, metadata !0, metadata !DIExpression()), !dbg !DILocation(scope: !1)
8   call void @llvm.dbg.value(metadata i32 %len, i64 0, metadata !10, metadata !DIExpression()), !dbg !DILocation(scope: !1)
9   call void @llvm.dbg.value(metadata i32 %hash, i64 0, metadata !11, metadata !DIExpression()), !dbg !DILocation(scope: !1)
10   call void @llvm.dbg.value(metadata i32 %flags, i64 0, metadata !12, metadata !DIExpression()), !dbg !DILocation(scope: !1)
11 ; CHECK:  call fastcc i8* @add_name_internal(i8* %name, i32 %hash) [[NUW:#[0-9]+]], !dbg !{{[0-9]+}}
12   %0 = call fastcc i8* @add_name_internal(i8* %name, i32 %len, i32 %hash, i8 zeroext 0, i32 %flags) nounwind, !dbg !13 ; <i8*> [#uses=1]
13   ret i8* %0, !dbg !13
14 }
15
16 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
17
18 define internal fastcc i8* @add_name_internal(i8* %name, i32 %len, i32 %hash, i8 zeroext %extra, i32 %flags) noinline nounwind ssp {
19 entry:
20   call void @llvm.dbg.value(metadata i8* %name, i64 0, metadata !15, metadata !DIExpression()), !dbg !DILocation(scope: !16)
21   call void @llvm.dbg.value(metadata i32 %len, i64 0, metadata !20, metadata !DIExpression()), !dbg !DILocation(scope: !16)
22   call void @llvm.dbg.value(metadata i32 %hash, i64 0, metadata !21, metadata !DIExpression()), !dbg !DILocation(scope: !16)
23   call void @llvm.dbg.value(metadata i8 %extra, i64 0, metadata !22, metadata !DIExpression()), !dbg !DILocation(scope: !16)
24   call void @llvm.dbg.value(metadata i32 %flags, i64 0, metadata !23, metadata !DIExpression()), !dbg !DILocation(scope: !16)
25   %0 = icmp eq i32 %hash, 0, !dbg !24             ; <i1> [#uses=1]
26   br i1 %0, label %bb, label %bb1, !dbg !24
27
28 bb:                                               ; preds = %entry
29   br label %bb2, !dbg !26
30
31 bb1:                                              ; preds = %entry
32   br label %bb2, !dbg !27
33
34 bb2:                                              ; preds = %bb1, %bb
35   %.0 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %bb ], [ %name, %bb1 ] ; <i8*> [#uses=1]
36   ret i8* %.0, !dbg !27
37 }
38
39 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
40
41 ; CHECK: attributes #0 = { nounwind ssp }
42 ; CHECK: attributes #1 = { nounwind readnone }
43 ; CHECK: attributes #2 = { noinline nounwind ssp }
44 ; CHECK: attributes [[NUW]] = { nounwind }
45
46 !llvm.dbg.cu = !{!3}
47 !llvm.module.flags = !{!30}
48 !0 = !DILocalVariable(name: "name", line: 8, arg: 1, scope: !1, file: !2, type: !6)
49 !1 = !DISubprogram(name: "vfs_addname", linkageName: "vfs_addname", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !28, scope: !2, type: !4)
50 !2 = !DIFile(filename: "tail.c", directory: "/Users/echeng/LLVM/radars/r7927803/")
51 !3 = !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build 9999)", isOptimized: true, emissionKind: 0, file: !28, enums: !29, retainedTypes: !29)
52 !4 = !DISubroutineType(types: !5)
53 !5 = !{!6, !6, !9, !9, !9}
54 !6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !28, scope: !2, baseType: !7)
55 !7 = !DIDerivedType(tag: DW_TAG_const_type, size: 8, align: 8, file: !28, scope: !2, baseType: !8)
56 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
57 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
58 !10 = !DILocalVariable(name: "len", line: 9, arg: 2, scope: !1, file: !2, type: !9)
59 !11 = !DILocalVariable(name: "hash", line: 10, arg: 3, scope: !1, file: !2, type: !9)
60 !12 = !DILocalVariable(name: "flags", line: 11, arg: 4, scope: !1, file: !2, type: !9)
61 !13 = !DILocation(line: 13, scope: !14)
62 !14 = distinct !DILexicalBlock(line: 12, column: 0, file: !28, scope: !1)
63 !15 = !DILocalVariable(name: "name", line: 17, arg: 1, scope: !16, file: !2, type: !6)
64 !16 = !DISubprogram(name: "add_name_internal", linkageName: "add_name_internal", line: 22, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !28, scope: !2, type: !17)
65 !17 = !DISubroutineType(types: !18)
66 !18 = !{!6, !6, !9, !9, !19, !9}
67 !19 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
68 !20 = !DILocalVariable(name: "len", line: 18, arg: 2, scope: !16, file: !2, type: !9)
69 !21 = !DILocalVariable(name: "hash", line: 19, arg: 3, scope: !16, file: !2, type: !9)
70 !22 = !DILocalVariable(name: "extra", line: 20, arg: 4, scope: !16, file: !2, type: !19)
71 !23 = !DILocalVariable(name: "flags", line: 21, arg: 5, scope: !16, file: !2, type: !9)
72 !24 = !DILocation(line: 23, scope: !25)
73 !25 = distinct !DILexicalBlock(line: 22, column: 0, file: !28, scope: !16)
74 !26 = !DILocation(line: 24, scope: !25)
75 !27 = !DILocation(line: 26, scope: !25)
76 !28 = !DIFile(filename: "tail.c", directory: "/Users/echeng/LLVM/radars/r7927803/")
77 !29 = !{}
78 !30 = !{i32 1, !"Debug Info Version", i32 3}