Debian Codegraph @

llvm/test/CodeGen/Thumb2/tbb-removeadd.mir

raw
1 #RUN: llc -run-pass arm-cp-islands %s -o - | FileCheck %s
2
3 --- |
4 ; ModuleID = 'test.ll'
5 source_filename = "test.c"
6 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
7 target triple = "thumbv8r-arm-none-eabi"
8
9 define void @Func(i32 %i, ptr nocapture %p) local_unnamed_addr {
10 entry:
11 switch i32 %i, label %sw.epilog [
12 i32 0, label %sw.bb
13 i32 1, label %sw.bb1
14 i32 2, label %sw.epilog.sink.split
15 i32 4, label %sw.bb3
16 ]
17
18 sw.bb: ; preds = %entry
19 br label %sw.epilog.sink.split
20
21 sw.bb1: ; preds = %entry
22 store i32 0, ptr %p, align 4
23 br label %sw.epilog.sink.split
24
25 sw.bb3: ; preds = %entry
26 br label %sw.epilog.sink.split
27
28 sw.epilog.sink.split: ; preds = %sw.bb3, %sw.bb1, %sw.bb, %entry
29 %.sink = phi i32 [ 2, %sw.bb3 ], [ 0, %sw.bb ], [ 1, %entry ], [ 1, %sw.bb1 ]
30 store i32 %.sink, ptr %p, align 4
31 br label %sw.epilog
32
33 sw.epilog: ; preds = %sw.epilog.sink.split, %entry
34 ret void
35 }
36
37 ...
38 ---
39 name: Func
40 alignment: 2
41 exposesReturnsTwice: false
42 legalized: false
43 regBankSelected: false
44 selected: false
45 tracksRegLiveness: true
46 liveins:
47 - { reg: '$r0' }
48 - { reg: '$r1' }
49 frameInfo:
50 isFrameAddressTaken: false
51 isReturnAddressTaken: false
52 hasStackMap: false
53 hasPatchPoint: false
54 stackSize: 0
55 offsetAdjustment: 0
56 maxAlignment: 0
57 adjustsStack: false
58 hasCalls: false
59 maxCallFrameSize: 0
60 hasOpaqueSPAdjustment: false
61 hasVAStart: false
62 hasMustTailInVarArgFunc: false
63 jumpTable:
64 kind: inline
65 entries:
66 - id: 0
67 blocks: [ '%bb.2.sw.bb', '%bb.3.sw.bb1', '%bb.5.sw.epilog.sink.split',
68 '%bb.6.sw.epilog', '%bb.4.sw.bb3' ]
69 # The ADD should be deleted along with the LEA
70 # CHECK-NOT: t2LEApcrelJT
71 # CHECK-NOT: t2ADDrs
72 # CHECK: tMOVi8
73 # CHECK: t2TBB_JT
74
75 body: |
76 bb.0.entry:
77 successors: %bb.6.sw.epilog(0x0ccccccb), %bb.1.entry(0x73333335)
78 liveins: $r0, $r1
79
80 tCMPi8 $r0, 4, 14, $noreg, implicit-def $cpsr
81 t2Bcc %bb.6.sw.epilog, 8, killed $cpsr
82
83 bb.1.entry:
84 successors: %bb.2.sw.bb(0x1c71c71c), %bb.3.sw.bb1(0x1c71c71c), %bb.5.sw.epilog.sink.split(0x1c71c71c), %bb.6.sw.epilog(0x0e38e38e), %bb.4.sw.bb3(0x1c71c71c)
85 liveins: $r0, $r1
86
87 $r2 = t2LEApcrelJT %jump-table.0, 14, $noreg
88 $r3 = t2ADDrs killed $r2, $r0, 18, 14, $noreg, $noreg
89 $r2, dead $cpsr = tMOVi8 1, 14, $noreg
90 t2BR_JT killed $r3, killed $r0, %jump-table.0
91
92 bb.2.sw.bb:
93 successors: %bb.5.sw.epilog.sink.split(0x80000000)
94 liveins: $r1
95
96 $r2, dead $cpsr = tMOVi8 0, 14, $noreg
97 t2B %bb.5.sw.epilog.sink.split, 14, $noreg
98
99 bb.3.sw.bb1:
100 successors: %bb.5.sw.epilog.sink.split(0x80000000)
101 liveins: $r1
102
103 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
104 $r2, dead $cpsr = tMOVi8 1, 14, $noreg
105 tSTRi killed $r0, $r1, 0, 14, $noreg :: (store (s32) into %ir.p)
106 t2B %bb.5.sw.epilog.sink.split, 14, $noreg
107
108 bb.4.sw.bb3:
109 successors: %bb.5.sw.epilog.sink.split(0x80000000)
110 liveins: $r1
111
112 $r2, dead $cpsr = tMOVi8 2, 14, $noreg
113
114 bb.5.sw.epilog.sink.split:
115 successors: %bb.6.sw.epilog(0x80000000)
116 liveins: $r1, $r2
117
118 tSTRi killed $r2, killed $r1, 0, 14, $noreg :: (store (s32) into %ir.p)
119
120 bb.6.sw.epilog:
121 tBX_RET 14, $noreg
122
123 ...