debuginfo.ll 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ; RUN: opt < %s -instcombine -S | FileCheck %s
  2. declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
  3. declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone
  4. declare i8* @foo(i8*, i32, i64, i64) nounwind
  5. define hidden i8* @foobar(i8* %__dest, i32 %__val, i64 %__len) nounwind inlinehint ssp {
  6. entry:
  7. %__dest.addr = alloca i8*, align 8
  8. %__val.addr = alloca i32, align 4
  9. %__len.addr = alloca i64, align 8
  10. store i8* %__dest, i8** %__dest.addr, align 8
  11. ; CHECK-NOT: call void @llvm.dbg.declare
  12. ; CHECK: call void @llvm.dbg.value
  13. call void @llvm.dbg.declare(metadata i8** %__dest.addr, metadata !0, metadata !DIExpression()), !dbg !16
  14. store i32 %__val, i32* %__val.addr, align 4
  15. call void @llvm.dbg.declare(metadata i32* %__val.addr, metadata !7, metadata !DIExpression()), !dbg !18
  16. store i64 %__len, i64* %__len.addr, align 8
  17. call void @llvm.dbg.declare(metadata i64* %__len.addr, metadata !9, metadata !DIExpression()), !dbg !20
  18. %tmp = load i8*, i8** %__dest.addr, align 8, !dbg !21
  19. %tmp1 = load i32, i32* %__val.addr, align 4, !dbg !21
  20. %tmp2 = load i64, i64* %__len.addr, align 8, !dbg !21
  21. %tmp3 = load i8*, i8** %__dest.addr, align 8, !dbg !21
  22. %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp3, i1 false), !dbg !21
  23. %call = call i8* @foo(i8* %tmp, i32 %tmp1, i64 %tmp2, i64 %0), !dbg !21
  24. ret i8* %call, !dbg !21
  25. }
  26. !llvm.dbg.cu = !{!3}
  27. !llvm.module.flags = !{!30}
  28. !0 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "__dest", line: 78, arg: 1, scope: !1, file: !2, type: !6)
  29. !1 = !DISubprogram(name: "foobar", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 79, file: !27, scope: !2, type: !4, function: i8* (i8*, i32, i64)* @foobar, variables: !25)
  30. !2 = !DIFile(filename: "string.h", directory: "Game")
  31. !3 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 127710)", isOptimized: true, emissionKind: 0, file: !28, enums: !29, retainedTypes: !29, subprograms: !24)
  32. !4 = !DISubroutineType(types: !5)
  33. !5 = !{!6}
  34. !6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !3, baseType: null)
  35. !7 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "__val", line: 78, arg: 2, scope: !1, file: !2, type: !8)
  36. !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  37. !9 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "__len", line: 78, arg: 3, scope: !1, file: !2, type: !10)
  38. !10 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", line: 80, file: !27, scope: !3, baseType: !11)
  39. !11 = !DIDerivedType(tag: DW_TAG_typedef, name: "__darwin_size_t", line: 90, file: !27, scope: !3, baseType: !12)
  40. !12 = !DIBasicType(tag: DW_TAG_base_type, name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
  41. !16 = !DILocation(line: 78, column: 28, scope: !1)
  42. !18 = !DILocation(line: 78, column: 40, scope: !1)
  43. !20 = !DILocation(line: 78, column: 54, scope: !1)
  44. !21 = !DILocation(line: 80, column: 3, scope: !22)
  45. !22 = distinct !DILexicalBlock(line: 80, column: 3, file: !27, scope: !23)
  46. !23 = distinct !DILexicalBlock(line: 79, column: 1, file: !27, scope: !1)
  47. !24 = !{!1}
  48. !25 = !{!0, !7, !9}
  49. !26 = !DIFile(filename: "bits.c", directory: "Game")
  50. !27 = !DIFile(filename: "string.h", directory: "Game")
  51. !28 = !DIFile(filename: "bits.c", directory: "Game")
  52. !29 = !{}
  53. !30 = !{i32 1, !"Debug Info Version", i32 3}