xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/tailmerging_in_mbp.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc <%s -march=aarch64 -verify-machine-dom-info | FileCheck %s
2
3; CHECK-LABEL: test:
4; CHECK:       LBB0_7:
5; CHECK:         b.hi
6; CHECK-NEXT:    b
7; CHECK-NEXT:  LBB0_8:
8; CHECK-NEXT:    mov	 x8, x9
9; CHECK-NEXT:  LBB0_9:
10define i64 @test(i64 %n, i64* %a, i64* %b, i64* %c, i64* %d, i64* %e, i64* %f) {
11entry:
12  %cmp28 = icmp sgt i64 %n, 1
13  br i1 %cmp28, label %for.body, label %for.end
14
15for.body:                                         ; preds = %for.body.lr.ph, %if.end
16  %j = phi i64 [ %n, %entry ], [ %div, %if.end ]
17  %div = lshr i64 %j, 1
18  %a.arrayidx = getelementptr inbounds i64, i64* %a, i64 %div
19  %a.j = load i64, i64* %a.arrayidx
20  %b.arrayidx = getelementptr inbounds i64, i64* %b, i64 %div
21  %b.j = load i64, i64* %b.arrayidx
22  %cmp.i = icmp slt i64 %a.j, %b.j
23  br i1 %cmp.i, label %for.end.loopexit, label %cond.false.i
24
25cond.false.i:                                     ; preds = %for.body
26  %cmp4.i = icmp sgt i64 %a.j, %b.j
27  br i1 %cmp4.i, label %if.end, label %cond.false6.i
28
29cond.false6.i:                                    ; preds = %cond.false.i
30  %c.arrayidx = getelementptr inbounds i64, i64* %c, i64 %div
31  %c.j = load i64, i64* %c.arrayidx
32  %d.arrayidx = getelementptr inbounds i64, i64* %d, i64 %div
33  %d.j = load i64, i64* %d.arrayidx
34  %cmp9.i = icmp slt i64 %c.j, %d.j
35  br i1 %cmp9.i, label %for.end.loopexit, label %cond.false11.i
36
37cond.false11.i:                                   ; preds = %cond.false6.i
38  %cmp14.i = icmp sgt i64 %c.j, %d.j
39  br i1 %cmp14.i, label %if.end, label %cond.false12.i
40
41cond.false12.i:                           ; preds = %cond.false11.i
42  %e.arrayidx = getelementptr inbounds i64, i64* %e, i64 %div
43  %e.j = load i64, i64* %e.arrayidx
44  %f.arrayidx = getelementptr inbounds i64, i64* %f, i64 %div
45  %f.j = load i64, i64* %f.arrayidx
46  %cmp19.i = icmp sgt i64 %e.j, %f.j
47  br i1 %cmp19.i, label %if.end, label %for.end.loopexit
48
49if.end:                                           ; preds = %cond.false12.i, %cond.false11.i, %cond.false.i
50  %cmp = icmp ugt i64 %j, 3
51  br i1 %cmp, label %for.body, label %for.end.loopexit
52
53for.end.loopexit:                                 ; preds = %cond.false12.i, %cond.false6.i, %for.body, %if.end
54  %j.0.lcssa.ph = phi i64 [ %j, %cond.false12.i ], [ %j, %cond.false6.i ], [ %j, %for.body ], [ %div, %if.end ]
55  br label %for.end
56
57for.end:                                          ; preds = %for.end.loopexit, %entry
58  %j.0.lcssa = phi i64 [ %n, %entry ], [ %j.0.lcssa.ph, %for.end.loopexit ]
59  %j.2 = add i64 %j.0.lcssa, %n
60  %j.3 = mul i64 %j.2, %n
61  %j.4 = add i64 %j.3, 10
62  ret i64 %j.4
63}
64