xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/combine-sext-debugloc.mir (revision 1ee315ae7964c8433b772e0b5d667834994ba753)
1# RUN: llc -O0 -verify-machineinstrs -mtriple aarch64-- -run-pass=legalizer %s -o - | FileCheck %s
2
3# Check that when we combine SEXT we assign the correct debug location.
4# CHECK: !9 = !DILocation(line: 36, column: 21, scope: !4)
5# CHECK: G_AND %4, %5, debug-location !9
6
7--- |
8  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
9  target triple = "aarch64-unknown-unknown"
10
11  define i64 @main(i8 %pat) personality ptr @__gxx_personality_v0 !dbg !4 {
12  entry:
13    %sext.1 = zext i8 %pat to i16, !dbg !8
14    %sext.zext.1 = sext i16 %sext.1 to i64, !dbg !9
15    ret i64 %sext.zext.1
16  }
17
18  declare void @printf(ptr, ...)
19
20  declare i32 @__gxx_personality_v0(...)
21
22  !llvm.dbg.cu = !{!0}
23  !llvm.module.flags = !{!2, !3}
24
25  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, nameTableKind: None, sysroot: "/pata/tino", sdk: "iPhoneOS13.0.sdk")
26  !1 = !DIFile(filename: "/pata/tino/main.cpp", directory: "/pata/tino")
27  !2 = !{i32 2, !"Debug Info Version", i32 3}
28  !3 = !{i32 7, !"PIC Level", i32 2}
29  !4 = distinct !DISubprogram(name: "main", scope: !5, file: !5, line: 19, type: !6, scopeLine: 20, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
30  !5 = !DIFile(filename: "main.cpp", directory: "/pata/tino")
31  !6 = !DISubroutineType(types: !7)
32  !7 = !{}
33  !8 = !DILocation(line: 23, column: 5, scope: !4)
34  !9 = !DILocation(line: 36, column: 21, scope: !4)
35
36...
37---
38name:            main
39body:             |
40  bb.1.entry:
41    liveins: $w0
42
43    %1:_(s32) = COPY $w0
44    %0:_(s8) = G_TRUNC %1(s32)
45    %2:_(s16) = G_ZEXT %0(s8), debug-location !8
46    %3:_(s64) = G_SEXT %2(s16), debug-location !9
47    $x0 = COPY %3(s64)
48    RET_ReallyLR implicit $x0
49
50...
51