hoist-dbgvalue.ll 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ; RUN: opt -simplifycfg -S < %s | FileCheck %s
  2. define i32 @foo(i32 %i) nounwind ssp {
  3. call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !6, metadata !DIExpression()), !dbg !7
  4. call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !9, metadata !DIExpression()), !dbg !11
  5. %1 = icmp ne i32 %i, 0, !dbg !12
  6. ;CHECK: call i32 (...) @bar()
  7. ;CHECK-NEXT: llvm.dbg.value
  8. br i1 %1, label %2, label %4, !dbg !12
  9. ; <label>:2 ; preds = %0
  10. %3 = call i32 (...) @bar(), !dbg !13
  11. call void @llvm.dbg.value(metadata i32 %3, i64 0, metadata !9, metadata !DIExpression()), !dbg !13
  12. br label %6, !dbg !15
  13. ; <label>:4 ; preds = %0
  14. %5 = call i32 (...) @bar(), !dbg !16
  15. call void @llvm.dbg.value(metadata i32 %5, i64 0, metadata !9, metadata !DIExpression()), !dbg !16
  16. br label %6, !dbg !18
  17. ; <label>:6 ; preds = %4, %2
  18. %k.0 = phi i32 [ %3, %2 ], [ %5, %4 ]
  19. ret i32 %k.0, !dbg !19
  20. }
  21. declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
  22. declare i32 @bar(...)
  23. declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
  24. !llvm.module.flags = !{!21}
  25. !llvm.dbg.sp = !{!0}
  26. !0 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !20, scope: !1, type: !3, function: i32 (i32)* @foo)
  27. !1 = !DIFile(filename: "b.c", directory: "/private/tmp")
  28. !2 = !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !20, enums: !8, retainedTypes: !8)
  29. !3 = !DISubroutineType(types: !4)
  30. !4 = !{!5}
  31. !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  32. !6 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "i", line: 2, arg: 1, scope: !0, file: !1, type: !5)
  33. !7 = !DILocation(line: 2, column: 13, scope: !0)
  34. !8 = !{i32 0}
  35. !9 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "k", line: 3, scope: !10, file: !1, type: !5)
  36. !10 = distinct !DILexicalBlock(line: 2, column: 16, file: !20, scope: !0)
  37. !11 = !DILocation(line: 3, column: 12, scope: !10)
  38. !12 = !DILocation(line: 4, column: 3, scope: !10)
  39. !13 = !DILocation(line: 5, column: 5, scope: !14)
  40. !14 = distinct !DILexicalBlock(line: 4, column: 10, file: !20, scope: !10)
  41. !15 = !DILocation(line: 6, column: 3, scope: !14)
  42. !16 = !DILocation(line: 7, column: 5, scope: !17)
  43. !17 = distinct !DILexicalBlock(line: 6, column: 10, file: !20, scope: !10)
  44. !18 = !DILocation(line: 8, column: 3, scope: !17)
  45. !19 = !DILocation(line: 9, column: 3, scope: !10)
  46. !20 = !DIFile(filename: "b.c", directory: "/private/tmp")
  47. !21 = !{i32 1, !"Debug Info Version", i32 3}