legalize-shift-imm-promote-dloc.mir 2.13 KB
# RUN: llc -mtriple=aarch64-- -run-pass=legalizer -verify-machineinstrs -O0 %s -o - | FileCheck %s
--- |
  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
  target triple = "arm64-apple-ios13.0.0"

  define void @test_shl_imm_promote_debug() {
    ret void
  }

  !llvm.module.flags = !{!0, !1, !2, !3, !4}
  !llvm.dbg.cu = !{!5}
  !llvm.ident = !{!8}

  !0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]}
  !1 = !{i32 7, !"Dwarf Version", i32 4}
  !2 = !{i32 2, !"Debug Info Version", i32 3}
  !3 = !{i32 1, !"wchar_size", i32 4}
  !4 = !{i32 7, !"PIC Level", i32 2}
  !5 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, producer: "clang")
  !6 = !DIFile(filename: "foo.c", directory: "/")
  !7 = !{}
  !8 = !{!"clang"}
  !9 = distinct !DISubprogram(name: "test_shl_imm_promote_debug", scope: !6, file: !6, line: 3, type: !10, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5, retainedNodes: !7)
  !10 = !DISubroutineType(types: !7)
  !11 = !DILocation(line: 4, column: 3, scope: !9)
  !12 = !DILocation(line: 5, column: 1, scope: !9)

...
---
name:            test_shl_imm_promote_debug
alignment:       4
tracksRegLiveness: true
liveins:
  - { reg: '$x0' }
  - { reg: '$w1' }
  - { reg: '$w2' }
body:             |
  bb.1:
    liveins: $w0, $w1

    ; Check that the G_LSHR has the right debug loc. This should also check that the G_ZEXT of the constant
    ; also has the right DL too, but it gets optimized away.
    ; CHECK-LABEL: name: test_shl_imm_promote_debug
    ; CHECK: liveins: $w0, $w1
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
    ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY1]], [[C]](s64), debug-location !DILocation(line: 4, column: 3
    ; CHECK: $w0 = COPY [[LSHR]](s32)
    ; CHECK: RET_ReallyLR debug-location !DILocation(line: 5, column: 1
    %0:_(p0) = COPY $x0
    %1:_(s32) = COPY $w1
    %2:_(s32) = G_CONSTANT i32 8
    %3:_(s32) = G_LSHR %1(s32), %2(s32), debug-location !11
    $w0 = COPY %3(s32)
    RET_ReallyLR debug-location !12

...