llvm/llvm/test/CodeGen/RISCV/sextw-removal-debug.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc %s -mtriple=riscv64 -run-pass=riscv-opt-w-instrs -o - | FileCheck %s

--- |
  define void @foo(i32 signext %a, i32 signext %b, ptr %c) !dbg !5 {
  entry:
    %add = add nsw i32 %b, %a, !dbg !11
    tail call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !11
    store i32 %add, ptr %c, align 4, !dbg !12
    ret void, !dbg !13
  }

  declare void @llvm.dbg.value(metadata, metadata, metadata) #0

  attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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

  !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
  !1 = !DIFile(filename: "test.ll", directory: "/")
  !2 = !{i32 3}
  !3 = !{i32 1}
  !4 = !{i32 2, !"Debug Info Version", i32 3}
  !5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
  !6 = !DISubroutineType(types: !7)
  !7 = !{}
  !8 = !{!9}
  !9 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !10)
  !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
  !11 = !DILocation(line: 1, column: 1, scope: !5)
  !12 = !DILocation(line: 2, column: 1, scope: !5)
  !13 = !DILocation(line: 3, column: 1, scope: !5)

...
---
name:            foo
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10, $x11, $x12

    ; CHECK-LABEL: name: foo
    ; CHECK: liveins: $x10, $x11, $x12
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x12
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x10
    ; CHECK-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[COPY1]], [[COPY2]], debug-location !11
    ; CHECK-NEXT: DBG_VALUE [[ADD]], $noreg, !9, !DIExpression(), debug-location !11
    ; CHECK-NEXT: SW killed [[ADD]], [[COPY]], 0, debug-location !12 :: (store (s32) into %ir.c)
    ; CHECK-NEXT: PseudoRET debug-location !13
    %2:gpr = COPY $x12
    %1:gpr = COPY $x11
    %0:gpr = COPY $x10
    %3:gpr = ADDW %1, %0, debug-location !11
    DBG_VALUE %3, $noreg, !9, !DIExpression(), debug-location !11
    SW killed %3, %2, 0, debug-location !12 :: (store (s32) into %ir.c)
    PseudoRET debug-location !13

...