Debian Codegraph @

llvm/test/CodeGen/Thumb2/LowOverheadLoops/revert-after-write.mir

raw
1 # RUN: llc -mtriple=thumbv8.1m.main %s -run-pass=arm-low-overhead-loops --verify-machineinstrs -o - | FileCheck %s
2
3 # CHECK: while.body:
4 # CHECK-NOT: t2DLS
5 # CHECK-NOT: t2LEUpdate
6
7 --- |
8 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
9 target triple = "thumbv8.1m.main"
10
11 define i32 @mov_between_dec_end(i32 %n) #0 {
12 entry:
13 %cmp6 = icmp eq i32 %n, 0
14 br i1 %cmp6, label %while.end, label %while.body.preheader
15
16 while.body.preheader: ; preds = %entry
17 %start = call i32 @llvm.start.loop.iterations.i32(i32 %n)
18 br label %while.body
19
20 while.body: ; preds = %while.body, %while.body.preheader
21 %0 = phi i32 [ %start, %while.body.preheader ], [ %1, %while.body ]
22 %1 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %0, i32 1)
23 %add = add i32 %1, 2
24 %2 = icmp ne i32 %1, 0
25 br i1 %2, label %while.body, label %while.end
26
27 while.end: ; preds = %while.body, %entry
28 %res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
29 ret i32 %res.0.lcssa
30 }
31
32 ; Function Attrs: noduplicate nounwind
33 declare i32 @llvm.start.loop.iterations.i32(i32) #1
34
35 ; Function Attrs: noduplicate nounwind
36 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) #1
37
38 ; Function Attrs: nounwind
39 declare void @llvm.stackprotector(ptr, ptr) #2
40
41 attributes #0 = { "target-features"="+mve.fp" }
42 attributes #1 = { noduplicate nounwind }
43 attributes #2 = { nounwind }
44
45 ...
46 ---
47 name: mov_between_dec_end
48 alignment: 2
49 exposesReturnsTwice: false
50 legalized: false
51 regBankSelected: false
52 selected: false
53 failedISel: false
54 tracksRegLiveness: true
55 hasWinCFI: false
56 registers: []
57 liveins:
58 - { reg: '$r0', virtual-reg: '' }
59 frameInfo:
60 isFrameAddressTaken: false
61 isReturnAddressTaken: false
62 hasStackMap: false
63 hasPatchPoint: false
64 stackSize: 8
65 offsetAdjustment: 0
66 maxAlignment: 4
67 adjustsStack: false
68 hasCalls: false
69 stackProtector: ''
70 maxCallFrameSize: 0
71 cvBytesOfCalleeSavedRegisters: 0
72 hasOpaqueSPAdjustment: false
73 hasVAStart: false
74 hasMustTailInVarArgFunc: false
75 localFrameSize: 0
76 savePoint: []
77 restorePoint: []
78 fixedStack: []
79 stack:
80 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
81 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
82 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
83 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
84 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
85 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
86 callSites: []
87 constants: []
88 machineFunctionInfo: {}
89 body: |
90 bb.0.entry:
91 successors: %bb.4(0x30000000), %bb.1(0x50000000)
92 liveins: $r0, $r7, $lr
93
94 frame-setup tPUSH 14, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
95 frame-setup CFI_INSTRUCTION def_cfa_offset 8
96 frame-setup CFI_INSTRUCTION offset $lr, -4
97 frame-setup CFI_INSTRUCTION offset $r7, -8
98 tCBZ $r0, %bb.4
99
100 bb.1.while.body.preheader:
101 successors: %bb.2(0x80000000)
102 liveins: $r0
103
104 $lr = tMOVr $r0, 14, $noreg
105 $lr = t2DoLoopStart killed $r0
106
107 bb.2.while.body:
108 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
109 liveins: $lr
110
111 $r4 = tMOVr $lr, 14, $noreg
112 renamable $lr = t2LoopDec killed renamable $lr, 1
113 renamable $r0 = t2ADDri renamable $lr, 2, 14, $noreg, $noreg
114 $lr = tMOVr $r4, 14, $noreg
115 t2LoopEnd renamable $lr, %bb.2, implicit-def dead $cpsr
116 tB %bb.3, 14, $noreg
117
118 bb.3.while.end:
119 liveins: $r0
120
121 tPOP_RET 14, $noreg, def $r7, def $pc, implicit killed $r0
122
123 bb.4:
124 renamable $r0, dead $cpsr = tMOVi8 0, 14, $noreg
125 tPOP_RET 14, $noreg, def $r7, def $pc, implicit killed $r0
126
127 ...