xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/legalize-memlib-debug-loc.mir (revision 1ee315ae7964c8433b772e0b5d667834994ba753)
1# RUN: llc -mtriple=aarch64-- -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
2--- |
3  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
4  target triple = "arm64-apple-ios13.0.0"
5
6  define void @test_memset_debug(ptr %ptr, i32 %c, i32 %len) local_unnamed_addr!dbg !9 {
7  entry:
8    %conv = zext i32 %len to i64, !dbg !11
9    %0 = trunc i32 %c to i8, !dbg !11
10    call void @llvm.memset.p0.i64(ptr align 1 %ptr, i8 %0, i64 %conv, i1 false) #3, !dbg !11
11    ret void, !dbg !12
12  }
13
14  declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1
15  attributes #1 = { argmemonly nounwind willreturn writeonly }
16
17  !llvm.module.flags = !{!0, !1, !2, !3, !4}
18  !llvm.dbg.cu = !{!5}
19  !llvm.ident = !{!8}
20
21  !0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]}
22  !1 = !{i32 7, !"Dwarf Version", i32 4}
23  !2 = !{i32 2, !"Debug Info Version", i32 3}
24  !3 = !{i32 1, !"wchar_size", i32 4}
25  !4 = !{i32 7, !"PIC Level", i32 2}
26  !5 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, producer: "clang")
27  !6 = !DIFile(filename: "foo.c", directory: "/")
28  !7 = !{}
29  !8 = !{!"clang"}
30  !9 = distinct !DISubprogram(name: "test_memset_debug", scope: !6, file: !6, line: 3, type: !10, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5, retainedNodes: !7)
31  !10 = !DISubroutineType(types: !7)
32  !11 = !DILocation(line: 4, column: 3, scope: !9)
33  !12 = !DILocation(line: 5, column: 1, scope: !9)
34
35...
36---
37name:            test_memset_debug
38alignment:       4
39tracksRegLiveness: true
40liveins:
41  - { reg: '$x0' }
42  - { reg: '$w1' }
43  - { reg: '$w2' }
44body:             |
45  bb.1.entry:
46    liveins: $w1, $w2, $x0
47
48    ; We're checking that the BL call has the debug loc of the original intrinsic call.
49    ; CHECK-LABEL: name: test_memset_debug
50    ; CHECK: BL &memset, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit $x2, debug-location !11
51    ; CHECK: RET_ReallyLR debug-location !12
52    %0:_(p0) = COPY $x0
53    %1:_(s32) = COPY $w1
54    %2:_(s32) = COPY $w2
55    %3:_(s64) = G_ZEXT %2(s32), debug-location !11
56    %4:_(s8) = G_TRUNC %1(s32), debug-location !11
57    G_MEMSET %0(p0), %4(s8), %3(s64), 0, debug-location !11 :: (store (s8) into %ir.ptr)
58    RET_ReallyLR debug-location !12
59
60...
61