xref: /llvm-project/llvm/test/CodeGen/ARM/jump-table-dbg-value.mir (revision c4ce967e3437864827fe8e8816c2a8993b4d796b)
1# RUN: llc -mtriple=thumbv6m-apple-unknown-macho --run-pass=arm-cp-islands -o - %s | FileCheck %s
2--- |
3  ; ModuleID = 'test.ll'
4  source_filename = "simple.ll"
5  target datalayout = "e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6  target triple = "thumbv6m-apple-unknown-macho"
7
8  define i32 @foo(i32 %in) !dbg !5 {
9    call void @llvm.dbg.value(metadata i32 0, metadata !9, metadata !DIExpression()), !dbg !11
10    switch i32 %in, label %default [
11      i32 0, label %l0
12      i32 1, label %l1
13      i32 2, label %l2
14      i32 3, label %l3
15    ], !dbg !11
16
17  default:                                          ; preds = %0
18    ret i32 42, !dbg !12
19
20  l0:                                               ; preds = %0
21    ret i32 0, !dbg !13
22
23  l1:                                               ; preds = %0
24    ret i32 1, !dbg !14
25
26  l2:                                               ; preds = %0
27    ret i32 2, !dbg !15
28
29  l3:                                               ; preds = %0
30    ret i32 3, !dbg !16
31  }
32
33  ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
34  declare void @llvm.dbg.value(metadata, metadata, metadata) #0
35
36  attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
37
38  !llvm.dbg.cu = !{!0}
39  !llvm.debugify = !{!2, !3}
40  !llvm.module.flags = !{!4}
41
42  !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
43  !1 = !DIFile(filename: "simple.ll", directory: "/")
44  !2 = !{i32 6}
45  !3 = !{i32 1}
46  !4 = !{i32 2, !"Debug Info Version", i32 3}
47  !5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
48  !6 = !DISubroutineType(types: !7)
49  !7 = !{}
50  !8 = !{!9}
51  !9 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !10)
52  !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
53  !11 = !DILocation(line: 1, column: 1, scope: !5)
54  !12 = !DILocation(line: 2, column: 1, scope: !5)
55  !13 = !DILocation(line: 3, column: 1, scope: !5)
56  !14 = !DILocation(line: 4, column: 1, scope: !5)
57  !15 = !DILocation(line: 5, column: 1, scope: !5)
58  !16 = !DILocation(line: 6, column: 1, scope: !5)
59
60...
61---
62name:            foo
63alignment:       2
64exposesReturnsTwice: false
65legalized:       false
66regBankSelected: false
67selected:        false
68failedISel:      false
69tracksRegLiveness: true
70hasWinCFI:       false
71callsEHReturn:   false
72callsUnwindInit: false
73hasEHCatchret:   false
74hasEHScopes:     false
75hasEHFunclets:   false
76debugInstrRef:   false
77failsVerification: false
78tracksDebugUserValues: true
79registers:       []
80liveins:
81  - { reg: '$r0', virtual-reg: '' }
82frameInfo:
83  isFrameAddressTaken: false
84  isReturnAddressTaken: false
85  hasStackMap:     false
86  hasPatchPoint:   false
87  stackSize:       0
88  offsetAdjustment: 0
89  maxAlignment:    1
90  adjustsStack:    false
91  hasCalls:        false
92  stackProtector:  ''
93  functionContext: ''
94  maxCallFrameSize: 0
95  cvBytesOfCalleeSavedRegisters: 0
96  hasOpaqueSPAdjustment: false
97  hasVAStart:      false
98  hasMustTailInVarArgFunc: false
99  hasTailCall:     false
100  localFrameSize:  0
101  savePoint:       ''
102  restorePoint:    ''
103fixedStack:      []
104stack:           []
105callSites:       []
106debugValueSubstitutions: []
107constants:       []
108machineFunctionInfo: {}
109jumpTable:
110  kind:            inline
111  entries:
112    - id:              0
113      blocks:          [ '%bb.3', '%bb.4', '%bb.5', '%bb.6' ]
114body:             |
115  bb.0 (%ir-block.0):
116    successors: %bb.2(0x19999998), %bb.1(0x66666668)
117    liveins: $r0
118
119    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
120    tCMPi8 renamable $r0, 3, 14 /* CC::al */, $noreg, implicit-def $cpsr, debug-location !11
121    tBcc %bb.2, 8 /* CC::hi */, killed $cpsr, debug-location !11
122
123  bb.1 (%ir-block.0):
124    successors: %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000), %bb.6(0x20000000)
125    liveins: $r0
126
127    renamable $r0, dead $cpsr = tLSLri killed renamable $r0, 2, 14 /* CC::al */, $noreg
128    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
129    renamable $r1 = tLEApcrelJT %jump-table.0, 14 /* CC::al */, $noreg
130    renamable $r0 = tLDRr renamable $r1, killed renamable $r0, 14 /* CC::al */, $noreg :: (load (s32) from jump-table)
131    renamable $r0, dead $cpsr = tADDrr killed renamable $r1, killed renamable $r0, 14 /* CC::al */, $noreg
132    tBR_JTr killed renamable $r0, %jump-table.0
133    ; CHECK: tTBB_JT
134
135  bb.3.l0:
136    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
137    renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
138    tBX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !13
139
140  bb.2.default:
141    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
142    renamable $r0, dead $cpsr = tMOVi8 42, 14 /* CC::al */, $noreg
143    tBX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !12
144
145  bb.4.l1:
146    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
147    renamable $r0, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
148    tBX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !14
149
150  bb.5.l2:
151    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
152    renamable $r0, dead $cpsr = tMOVi8 2, 14 /* CC::al */, $noreg
153    tBX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !15
154
155  bb.6.l3:
156    DBG_VALUE 0, $noreg, !9, !DIExpression(), debug-location !11
157    renamable $r0, dead $cpsr = tMOVi8 3, 14 /* CC::al */, $noreg
158    tBX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !16
159
160...
161