1 # RUN: llc -mtriple=thumbv8.1m.main -mattr=+lob %s -run-pass=arm-low-overhead-loops --verify-machineinstrs -o - | FileCheck %s
3 # TODO: Remove the lr = tMOVr
5 # CHECK: $lr = t2WLS $r2, [[EXIT:%bb[.0-9]+]]
6 # CHECK: [[PREHEADER:bb[.0-9a-z]+]]:
7 # CHECK: $lr = tMOVr killed $r2
8 # CHECK: [[BODY:bb[.0-9a-z]+]]:
9 # CHECK: $lr = t2LEUpdate renamable $lr
12 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
13 target triple = "thumbv8.1m.main-arm-unknown"
15 ; Function Attrs: norecurse nounwind optsize
16 define dso_local arm_aapcscc void @copy(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
18 %cmp4 = icmp eq i32 %N, 0
19 %0 = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
20 br i1 %0, label %while.body.preheader, label %while.end
22 while.body.preheader: ; preds = %entry
25 while.body: ; preds = %while.body, %while.body.preheader
26 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
27 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
28 %1 = phi i32 [ %N, %while.body.preheader ], [ %3, %while.body ]
29 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
30 %2 = load i16, i16* %b.addr.05, align 2, !tbaa !3
31 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
32 store i16 %2, i16* %a.addr.06, align 2, !tbaa !3
33 %3 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %1, i32 1)
34 %4 = icmp ne i32 %3, 0
35 br i1 %4, label %while.body, label %while.end
37 while.end: ; preds = %while.body, %entry
41 declare i1 @llvm.test.set.loop.iterations.i32(i32) #1
42 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) #1
44 attributes #1 = { noduplicate nounwind }
45 attributes #2 = { nounwind }
47 !llvm.module.flags = !{!0, !1}
49 !0 = !{i32 1, !"wchar_size", i32 4}
50 !1 = !{i32 1, !"min_enum_size", i32 4}
52 !4 = !{!"short", !5, i64 0}
53 !5 = !{!"omnipotent char", !6, i64 0}
54 !6 = !{!"Simple C/C++ TBAA"}
60 exposesReturnsTwice: false
62 regBankSelected: false
65 tracksRegLiveness: false
69 - { reg: '$r0', virtual-reg: '' }
70 - { reg: '$r1', virtual-reg: '' }
71 - { reg: '$r2', virtual-reg: '' }
73 isFrameAddressTaken: false
74 isReturnAddressTaken: false
84 cvBytesOfCalleeSavedRegisters: 0
85 hasOpaqueSPAdjustment: false
87 hasMustTailInVarArgFunc: false
93 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
94 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
95 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
96 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
97 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
98 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
100 machineFunctionInfo: {}
103 successors: %bb.1(0x40000000), %bb.3(0x40000000)
105 frame-setup tPUSH 14, $noreg, $r7, killed $lr, implicit-def $sp, implicit $sp
106 frame-setup CFI_INSTRUCTION def_cfa_offset 8
107 frame-setup CFI_INSTRUCTION offset $lr, -4
108 frame-setup CFI_INSTRUCTION offset $r7, -8
109 $r7 = frame-setup tMOVr $sp, 14, $noreg
110 frame-setup CFI_INSTRUCTION def_cfa_register $r7
111 t2WhileLoopStart $r2, %bb.3
114 bb.1.while.body.preheader:
115 successors: %bb.2(0x80000000)
117 $lr = tMOVr killed $r2, 14, $noreg
120 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
122 renamable $r2, renamable $r1 = t2LDRH_POST killed renamable $r1, 2, 14, $noreg :: (load 2 from %ir.b.addr.05, !tbaa !3)
123 early-clobber renamable $r0 = t2STRH_POST killed renamable $r2, killed renamable $r0, 2, 14, $noreg :: (store 2 into %ir.a.addr.06, !tbaa !3)
124 renamable $lr = t2LoopDec killed renamable $lr, 1
125 t2LoopEnd renamable $lr, %bb.2
129 tPOP_RET 14, $noreg, def $r7, def $pc