call-site-param-mov16.mir 2.33 KB
# RUN: llc -emit-call-site-info -start-after=machineverifier -filetype=obj -o - %s \
# RUN:     | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter

## This test would previously trigger an assertion when trying to describe the
## call site value for the MOV16ri instruction.
## Based on the following reproducer:
##  a(short);
##  b() { a(1); }

--- |
  target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-w64-windows-gnu"
  
  ; Function Attrs: nounwind uwtable
  define dso_local i32 @b() local_unnamed_addr !dbg !14 {
  entry:
    %call = tail call i32 @a(i16 1), !dbg !17
    ret i32 undef, !dbg !18
  }
  
  declare !dbg !4 dso_local i32 @a(i16) local_unnamed_addr
  
  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!9, !10, !11, !12}
  !llvm.ident = !{!13}
  
  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
  !1 = !DIFile(filename: "1.c", directory: "/")
  !2 = !{}
  !3 = !{!4}
  !4 = !DISubprogram(name: "a", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
  !5 = !DISubroutineType(types: !6)
  !6 = !{!7, !8}
  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !8 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)
  !9 = !{i32 7, !"Dwarf Version", i32 4}
  !10 = !{i32 2, !"Debug Info Version", i32 3}
  !11 = !{i32 1, !"wchar_size", i32 2}
  !12 = !{i32 7, !"PIC Level", i32 2}
  !13 = !{!"clang version 11.0.0"}
  !14 = distinct !DISubprogram(name: "b", scope: !1, file: !1, line: 3, type: !15, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
  !15 = !DISubroutineType(types: !16)
  !16 = !{!7}
  !17 = !DILocation(line: 4, column: 3, scope: !14)
  !18 = !DILocation(line: 5, column: 1, scope: !14)

...
---
name:            b
alignment:       16
callSites:
  - { bb: 0, offset: 1, fwdArgRegs: 
      - { arg: 0, reg: '$cx' } }
body:             |
  bb.0.entry:
    $cx = MOV16ri 1, debug-location !17
    TAILJMPd64 @a, csr_win64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit killed $cx, debug-location !17

...