1; RUN: llc -march=mipsel -relocation-model=pic -mips-tail-calls=1 < %s | FileCheck %s
2
3; CHECK-LABEL: foo6:
4; CHECK: %while.body
5; CHECK: lw  $25, %call16(foo2)(${{[0-9]+}})
6; CHECK: jalr $25
7; CHECK: %while.end
8
9define void @foo6(i32 %n) {
10entry:
11  %tobool1 = icmp eq i32 %n, 0
12  br i1 %tobool1, label %while.end, label %while.body
13
14while.body:                                       ; preds = %entry, %while.body
15  %n.addr.02 = phi i32 [ %dec, %while.body ], [ %n, %entry ]
16  %dec = add nsw i32 %n.addr.02, -1
17  tail call void @foo2()
18  %tobool = icmp eq i32 %dec, 0
19  br i1 %tobool, label %while.end, label %while.body
20
21while.end:                                        ; preds = %while.body, %entry
22  ret void
23}
24
25declare void @foo2()
26
27; CHECK-LABEL: foo1:
28; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
29; CHECK: jalr $25
30; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
31; CHECK: jalr $25
32; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
33; CHECK: jalr $25
34
35define void @foo1() {
36entry:
37  tail call void @foo2()
38  tail call void @foo2()
39  tail call void @foo2()
40  ret void
41}
42