debug-label-mi.ll 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ; Test DBG_LABEL MachineInstr for label debugging.
  2. ; REQUIRES: asserts
  3. ; RUN: llc -debug-only=isel %s -o /dev/null 2> %t.debug
  4. ; RUN: cat %t.debug | FileCheck %s --check-prefix=CHECKMI
  5. ;
  6. ; CHECKMI: DBG_LABEL "top", debug-location !9
  7. ; CHECKMI: DBG_LABEL "done", debug-location !11
  8. ;
  9. ; RUN: llc %s -o - | FileCheck %s --check-prefix=CHECKASM
  10. ;
  11. ; CHECKASM: DEBUG_LABEL: foo:top
  12. ; CHECKASM: DEBUG_LABEL: foo:done
  13. source_filename = "debug-label-mi.c"
  14. ; Function Attrs: noinline nounwind optnone
  15. define i32 @foo(i32 signext %a, i32 signext %b) #0 !dbg !4 {
  16. entry:
  17. %a.addr = alloca i32, align 4
  18. %b.addr = alloca i32, align 4
  19. %sum = alloca i32, align 4
  20. store i32 %a, i32* %a.addr, align 4
  21. store i32 %b, i32* %b.addr, align 4
  22. br label %top
  23. top: ; preds = %entry
  24. call void @llvm.dbg.label(metadata !8), !dbg !9
  25. %0 = load i32, i32* %a.addr, align 4
  26. %1 = load i32, i32* %b.addr, align 4
  27. %add = add nsw i32 %0, %1
  28. store i32 %add, i32* %sum, align 4
  29. br label %done
  30. done: ; preds = %top
  31. call void @llvm.dbg.label(metadata !10), !dbg !11
  32. %2 = load i32, i32* %sum, align 4
  33. ret i32 %2
  34. }
  35. ; Function Attrs: nounwind readnone speculatable
  36. declare void @llvm.dbg.label(metadata)
  37. attributes #0 = { noinline nounwind optnone uwtable }
  38. !llvm.dbg.cu = !{!0}
  39. !llvm.module.flags = !{!3}
  40. !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, emissionKind: FullDebug, enums: !2)
  41. !1 = !DIFile(filename: "debug-label-mi.c", directory: "./")
  42. !2 = !{}
  43. !3 = !{i32 2, !"Debug Info Version", i32 3}
  44. !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)
  45. !5 = !DISubroutineType(types: !6)
  46. !6 = !{!7, !7, !7}
  47. !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  48. !8 = !DILabel(scope: !4, name: "top", file: !1, line: 4)
  49. !9 = !DILocation(line: 4, column: 1, scope: !4)
  50. !10 = !DILabel(scope: !4, name: "done", file: !1, line: 7)
  51. !11 = !DILocation(line: 7, column: 1, scope: !4)