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: b .LBB0_2
12 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
13 ; CHECK-NEXT: cmpldi 30, 100
14 ; CHECK-NEXT: bne 0, .LBB0_1
19 %ind = phi i64 [%a, %entry], [%val3, %latch]
20 %cond1 = icmp eq i64 %ind, 100
21 br i1 %cond1, label %middle, label %latch
24 %condx = call i1 @foo()
25 %val1 = xor i64 %ind, 2
29 %val2 = phi i64 [%ind, %header], [%val1, %middle]
30 %val3 = add i64 %val2, 1
31 %cond2 = call i1 @foo()
32 br i1 %cond2, label %end, label %header
38 ; No duplication of loop header into latches.
39 define void @no_duplicate2(i64 %a) {
40 ; CHECK-LABEL: no_duplicate2
42 ; CHECK-NEXT: b .LBB1_2
45 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
46 ; CHECK-NEXT: cmpldi 30, 100
47 ; CHECK-NEXT: bne 0, .LBB1_1
58 %ind = phi i64 [%a, %entry], [%val1, %latch1], [%val2, %latch2], [%val2, %latch3]
59 %cond1 = icmp eq i64 %ind, 100
60 br i1 %cond1, label %middle1, label %latch1
63 %cond2 = call i1 @foo()
64 %val1 = xor i64 %ind, 2
65 br i1 %cond2, label %end, label %header
68 %cond3 = call i1 @foo()
69 br i1 %cond3, label %latch1, label %middle2
72 %cond4 = call i1 @foo()
73 %val2 = add i64 %ind, 1
74 br i1 %cond4, label %latch2, label %latch3