1 ; RUN: llc -O2 < %s | FileCheck %s
3 target triple = "powerpc64le-grtev4-linux-gnu"
5 ; No duplication of loop header into entry block.
6 define void @no_duplicate1(i64 %a) {
7 ; CHECK-LABEL: no_duplicate1
9 ; CHECK-NEXT: std 0, 64(1)
10 ; CHECK-NEXT: b .LBB0_2
13 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
14 ; CHECK-NEXT: cmpldi 30, 100
15 ; CHECK-NEXT: bne 0, .LBB0_1
20 %ind = phi i64 [%a, %entry], [%val3, %latch]
21 %cond1 = icmp eq i64 %ind, 100
22 br i1 %cond1, label %middle, label %latch
25 %condx = call i1 @foo()
26 %val1 = xor i64 %ind, 2
30 %val2 = phi i64 [%ind, %header], [%val1, %middle]
31 %val3 = add i64 %val2, 1
32 %cond2 = call i1 @foo()
33 br i1 %cond2, label %end, label %header
39 ; No duplication of loop header into latches.
40 define void @no_duplicate2(i64 %a) {
41 ; CHECK-LABEL: no_duplicate2
43 ; CHECK-NEXT: std 0, 64(1)
44 ; CHECK-NEXT: b .LBB1_2
47 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
48 ; CHECK-NEXT: cmpldi 30, 100
49 ; CHECK-NEXT: bne 0, .LBB1_1
60 %ind = phi i64 [%a, %entry], [%val1, %latch1], [%val2, %latch2], [%val2, %latch3]
61 %cond1 = icmp eq i64 %ind, 100
62 br i1 %cond1, label %middle1, label %latch1
65 %cond2 = call i1 @foo()
66 %val1 = xor i64 %ind, 2
67 br i1 %cond2, label %end, label %header
70 %cond3 = call i1 @foo()
71 br i1 %cond3, label %latch1, label %middle2
74 %cond4 = call i1 @foo()
75 %val2 = add i64 %ind, 1
76 br i1 %cond4, label %latch2, label %latch3