llvm/llvm/test/CodeGen/X86/heap-alloc-markers.mir

# RUN: llc -mtriple=x86_64-unknown-windows-msvc -start-before=x86-flags-copy-lowering -o - %s | FileCheck %s
#
# Test the emission of heap alloc site instruction labels.

--- |
  declare ptr @alloc(i32) nounwind

  define i32 @test(i32 %x) nounwind !dbg !6 {
  entry:
    call ptr @alloc(i32 %x), !dbg !11, !heapallocsite !2
    ret i32 0, !dbg !12
  }

  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3, !4, !5}

  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
  !1 = !DIFile(filename: "<stdin>", directory: "")
  !2 = !{}
  !3 = !{i32 2, !"CodeView", i32 1}
  !4 = !{i32 2, !"Debug Info Version", i32 3}
  !5 = !{i32 1, !"wchar_size", i32 2}
  !6 = distinct !DISubprogram(name: "test", scope: !7, file: !7, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
  !7 = !DIFile(filename: "test.c", directory: "")
  !8 = !DISubroutineType(types: !9)
  !9 = !{!10, !10}
  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !11 = !DILocation(line: 3, scope: !6)
  !12 = !DILocation(line: 4, scope: !6)

...
---
name: test
# CHECK-LABEL: {{^}}test:
tracksRegLiveness: true
frameInfo:
  adjustsStack:    true
  hasCalls: true
body: |
  bb.0.entry:
    liveins: $ecx

    ADJCALLSTACKDOWN64 32, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !11
    CALL64pcrel32 @alloc, csr_win64, implicit $rsp, implicit $ssp, implicit $ecx, implicit-def $rsp, implicit-def $ssp, implicit-def dead $rax, heap-alloc-marker !2, debug-location !11
  ; CHECK:      callq alloc
  ; CHECK-NEXT: .Ltmp{{.*}}:
    ADJCALLSTACKUP64 32, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !11
    $eax = MOV32r0 implicit-def dead $eflags, debug-location !12
    RET 0, killed $eax, debug-location !12

...