1 # RUN: llc -mtriple=armv8.1m.main -mattr=+lob -run-pass=arm-low-overhead-loops --verify-machineinstrs %s -o - | FileCheck %s
4 # CHECK-NOT: t2LEUpdate
7 ; ModuleID = 'multiblock-massive.ll'
8 source_filename = "multiblock-massive.ll"
9 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
10 target triple = "thumbv8.1m.main"
12 define void @size_limit(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
14 %cmp8 = icmp eq i32 %N, 0
15 br i1 %cmp8, label %for.cond.cleanup, label %for.body.preheader
17 for.body.preheader: ; preds = %entry
18 call void @llvm.set.loop.iterations.i32(i32 %N)
21 for.cond.cleanup: ; preds = %for.end, %entry
24 for.body: ; preds = %for.end, %for.body.preheader
25 %lsr.iv4 = phi i32* [ %b, %for.body.preheader ], [ %scevgep5, %for.end ]
26 %lsr.iv2 = phi i32* [ %c, %for.body.preheader ], [ %scevgep3, %for.end ]
27 %lsr.iv1 = phi i32* [ %a, %for.body.preheader ], [ %scevgep, %for.end ]
28 %lsr.iv = phi i32 [ %N, %for.body.preheader ], [ %lsr.iv.next, %for.end ]
29 %size = call i32 @llvm.arm.space(i32 3072, i32 undef)
30 %0 = load i32, i32* %lsr.iv4, align 4
31 %1 = load i32, i32* %lsr.iv2, align 4
32 %mul = mul nsw i32 %1, %0
33 store i32 %mul, i32* %lsr.iv1, align 4
34 %cmp = icmp ne i32 %0, 0
35 br i1 %cmp, label %middle.block, label %for.end
37 middle.block: ; preds = %for.body
38 %div = udiv i32 %1, %0
39 store i32 %div, i32* %lsr.iv1, align 4
40 %size.1 = call i32 @llvm.arm.space(i32 1024, i32 undef)
43 for.end: ; preds = %middle.block, %for.body
44 %scevgep = getelementptr i32, i32* %lsr.iv1, i32 1
45 %scevgep3 = getelementptr i32, i32* %lsr.iv2, i32 1
46 %scevgep5 = getelementptr i32, i32* %lsr.iv4, i32 1
47 %lsr.iv.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %lsr.iv, i32 1)
48 %exitcond = icmp eq i32 %lsr.iv.next, 0
49 br i1 %exitcond, label %for.cond.cleanup, label %for.body
52 ; Function Attrs: nounwind
53 declare i32 @llvm.arm.space(i32 immarg, i32) #0
55 ; Function Attrs: noduplicate nounwind
56 declare void @llvm.set.loop.iterations.i32(i32) #1
58 ; Function Attrs: noduplicate nounwind
59 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) #1
61 ; Function Attrs: nounwind
62 declare void @llvm.stackprotector(i8*, i8**) #0
64 attributes #0 = { nounwind }
65 attributes #1 = { noduplicate nounwind }
71 exposesReturnsTwice: false
73 regBankSelected: false
76 tracksRegLiveness: true
80 - { reg: '$r0', virtual-reg: '' }
81 - { reg: '$r1', virtual-reg: '' }
82 - { reg: '$r2', virtual-reg: '' }
83 - { reg: '$r3', virtual-reg: '' }
85 isFrameAddressTaken: false
86 isReturnAddressTaken: false
96 cvBytesOfCalleeSavedRegisters: 0
97 hasOpaqueSPAdjustment: false
99 hasMustTailInVarArgFunc: false
105 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
106 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
107 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
108 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
109 stack-id: default, callee-saved-register: '$r4', callee-saved-restored: true,
110 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
113 machineFunctionInfo: {}
116 successors: %bb.2(0x80000000)
117 liveins: $r0, $r1, $r2, $r3, $r4, $lr
119 frame-setup tPUSH 14, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp
120 frame-setup CFI_INSTRUCTION def_cfa_offset 8
121 frame-setup CFI_INSTRUCTION offset $lr, -4
122 frame-setup CFI_INSTRUCTION offset $r4, -8
123 tCMPi8 $r3, 0, 14, $noreg, implicit-def $cpsr
124 t2IT 0, 8, implicit-def $itstate
125 tPOP_RET 0, killed $cpsr, def $r4, def $pc, implicit killed $itstate
126 $lr = tMOVr $r3, 14, $noreg
127 t2DoLoopStart killed $r3
131 successors: %bb.4(0x04000000), %bb.2(0x7c000000)
132 liveins: $lr, $r0, $r1, $r2
134 renamable $r1, dead $cpsr = tADDi8 killed renamable $r1, 4, 14, $noreg
135 renamable $r2, dead $cpsr = tADDi8 killed renamable $r2, 4, 14, $noreg
136 renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 4, 14, $noreg
137 renamable $lr = t2LoopDec killed renamable $lr, 1
138 t2LoopEnd renamable $lr, %bb.2, implicit-def dead $cpsr
139 t2B %bb.4, 14, $noreg
142 successors: %bb.3(0x50000000), %bb.1(0x30000000)
143 liveins: $lr, $r0, $r1, $r2
145 dead renamable $r3 = SPACE 3072, undef renamable $r0
146 renamable $r3 = tLDRi renamable $r1, 0, 14, $noreg :: (load 4 from %ir.lsr.iv4)
147 renamable $r12 = t2LDRi12 renamable $r2, 0, 14, $noreg :: (load 4 from %ir.lsr.iv2)
148 tCMPi8 renamable $r3, 0, 14, $noreg, implicit-def $cpsr
149 renamable $r4 = nsw t2MUL renamable $r12, renamable $r3, 14, $noreg
150 tSTRi killed renamable $r4, renamable $r0, 0, 14, $noreg :: (store 4 into %ir.lsr.iv1)
151 t2Bcc %bb.1, 0, killed $cpsr
154 successors: %bb.1(0x80000000)
155 liveins: $lr, $r0, $r1, $r2, $r3, $r12
157 renamable $r3 = t2UDIV killed renamable $r12, killed renamable $r3, 14, $noreg
158 tSTRi killed renamable $r3, renamable $r0, 0, 14, $noreg :: (store 4 into %ir.lsr.iv1)
159 dead renamable $r3 = SPACE 1024, undef renamable $r0
160 t2B %bb.1, 14, $noreg
162 bb.4.for.cond.cleanup:
163 tPOP_RET 14, $noreg, def $r4, def $pc