2 ; RUN: opt -loop-reduce -debug-only=loop-reduce -S < %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-i64:64-n32:64"
5 target triple = "powerpc64le-unknown-linux-gnu"
7 ; %lsr.iv2 and %lsr.iv10 are in same bb, but they are not equal since start
10 ; %scevgep = getelementptr [0 x %0], [0 x %0]* %arg, i64 0, i64 99
11 ; %scevgep1 = bitcast %0* %scevgep to [0 x %0]*
12 ; %lsr.iv2 = phi [0 x %0]* [ %1, %bb18 ], [ %scevgep1, %bb ]
14 ; %lsr.iv10 = phi [0 x %0]* [ %2, %bb18 ], [ %arg, %bb ]
16 ; Make sure two incomplete phis will not be marked as congruent.
18 ; CHECK: One incomplete PHI is found: %[[IV:.*]] = phi ptr
19 ; CHECK: One incomplete PHI is found: %[[IV2:.*]] = phi ptr
20 ; CHECK-NOT: Eliminated congruent iv: %[[IV]]
21 ; CHECK-NOT: Original iv: %[[IV2]]
22 ; CHECK-NOT: Eliminated congruent iv: %[[IV2]]
23 ; CHECK-NOT: Original iv: %[[IV]]
27 define void @foo(ptr %arg) {
29 %i = getelementptr inbounds [0 x %0], ptr %arg, i64 0, i64 -1
30 %i2 = getelementptr i8, ptr %i, i64 4
33 bb3: ; preds = %bb18, %bb
34 %i4 = phi i64 [ %i20, %bb18 ], [ 0, %bb ]
35 %i5 = phi i64 [ %i21, %bb18 ], [ 1, %bb ]
36 br i1 undef, label %bb22, label %bb9
38 bb9: ; preds = %bb9, %bb3
39 %i10 = phi i64 [ 0, %bb3 ], [ %i16, %bb9 ]
40 %i11 = add i64 %i10, %i4
41 %i12 = shl i64 %i11, 2
42 %i13 = getelementptr i8, ptr %i2, i64 %i12
43 store <4 x float> undef, ptr %i13, align 4
44 %i16 = add i64 %i10, 32
45 br i1 true, label %bb17, label %bb9
48 br i1 undef, label %bb18, label %bb22
51 %i19 = add i64 undef, %i4
52 %i20 = add i64 %i19, %i5
53 %i21 = add nuw nsw i64 %i5, 1
56 bb22: ; preds = %bb22, %bb17, %bb3
57 %i23 = phi i64 [ %i26, %bb22 ], [ undef, %bb17 ], [ 100, %bb3 ]
58 %i24 = add nsw i64 %i23, %i4
59 %i25 = getelementptr %0, ptr %i, i64 %i24, i32 0
60 store float undef, ptr %i25, align 4
61 %i26 = add nuw nsw i64 %i23, 1