1# RUN: llc -march=hexagon -run-pass hexagon-packetizer %s -o - | FileCheck %s
2
3##############################################################################
4# This test case is not really hexagon specific, but we use hexagon to get
5# bundling.
6#
7# The goal is to verify that the BUNDLE instruction is getting the first
8# non-empty debug location among the bundled instructions.
9##############################################################################
10
11--- |
12  define void @test() { ret void }
13
14  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "llvm", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, retainedTypes: !3)
15  !1 = distinct !DISubprogram(name: "test", scope: !3, file: !3, line: 1, type: !2, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
16  !2 = !DISubroutineType(types: !3)
17  !3 = !{null}
18  !5 = !DILocation(line: 126, column: 9, scope: !2)
19  !6 = !DILocation(line: 321, column: 4, scope: !2)
20
21...
22---
23name: test
24tracksRegLiveness: true
25body: |
26  bb.0:
27    liveins: $r1
28    $r2 = L2_loadri_io $r1, 0, debug-location !5
29    $r3 = L2_loadri_io $r1, 0, debug-location !6
30
31    $r4 = L2_loadri_io $r1, 0
32    $r5 = L2_loadri_io $r1, 0, debug-location !5
33
34    $r6 = L2_loadri_io $r1, 0, debug-location !6
35    $r7 = L2_loadri_io $r1, 0
36
37    $r8 = L2_loadri_io $r1, 0
38    $r9 = L2_loadri_io $r1, 0
39...
40
41# CHECK-LABEL: name: test
42
43# CHECK: BUNDLE
44# CHECK-SAME: debug-location [[DL1:!DILocation([^)]+)]]
45# CHECK-NEXT: L2_loadri_io $r1, 0, debug-location [[DL1]]
46# CHECK-NEXT: L2_loadri_io $r1, 0, debug-location [[DL2:!DILocation([^)]+)]]
47
48# CHECK: BUNDLE
49# CHECK-SAME: debug-location [[DL1]]
50# CHECK-NEXT: L2_loadri_io $r1, 0{{$}}
51# CHECK-NEXT: L2_loadri_io $r1, 0, debug-location [[DL1]]
52
53# CHECK: BUNDLE
54# CHECK-SAME: debug-location [[DL2]]
55# CHECK-NEXT: L2_loadri_io $r1, 0, debug-location [[DL2]]
56
57# No debug-location printouts expected for the last bundle
58# CHECK-NOT: debug-location
59