• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: asserts
2; RUN: opt -loop-reduce -debug-only=loop-reduce -S  < %s 2>&1 | FileCheck %s
3
4target datalayout = "e-m:e-i64:64-n32:64"
5target triple = "powerpc64le-unknown-linux-gnu"
6;
7; %lsr.iv2 and %lsr.iv10 are in same bb, but they are not equal since start
8; value are different.
9;
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 ]
13;
14; %lsr.iv10 = phi [0 x %0]* [ %2, %bb18 ], [ %arg, %bb ]
15;
16; Make sure two incomplete phis will not be marked as congruent.
17;
18; CHECK: One incomplete PHI is found:   %[[IV:.*]] = phi [0 x %0]*
19; CHECK: One incomplete PHI is found:   %[[IV2:.*]] = phi [0 x %0]*
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]]
24
25%0 = type <{ float }>
26
27define void @foo([0 x %0]* %arg) {
28bb:
29  %i = getelementptr inbounds [0 x %0], [0 x %0]* %arg, i64 0, i64 -1
30  %i1 = bitcast %0* %i to i8*
31  %i2 = getelementptr i8, i8* %i1, i64 4
32  br label %bb3
33
34bb3:                                              ; preds = %bb18, %bb
35  %i4 = phi i64 [ %i20, %bb18 ], [ 0, %bb ]
36  %i5 = phi i64 [ %i21, %bb18 ], [ 1, %bb ]
37  br i1 undef, label %bb22, label %bb9
38
39bb9:                                              ; preds = %bb9, %bb3
40  %i10 = phi i64 [ 0, %bb3 ], [ %i16, %bb9 ]
41  %i11 = add i64 %i10, %i4
42  %i12 = shl i64 %i11, 2
43  %i13 = getelementptr i8, i8* %i2, i64 %i12
44  %i14 = bitcast i8* %i13 to float*
45  %i15 = bitcast float* %i14 to <4 x float>*
46  store <4 x float> undef, <4 x float>* %i15, align 4
47  %i16 = add i64 %i10, 32
48  br i1 true, label %bb17, label %bb9
49
50bb17:                                             ; preds = %bb9
51  br i1 undef, label %bb18, label %bb22
52
53bb18:                                             ; preds = %bb17
54  %i19 = add i64 undef, %i4
55  %i20 = add i64 %i19, %i5
56  %i21 = add nuw nsw i64 %i5, 1
57  br label %bb3
58
59bb22:                                             ; preds = %bb22, %bb17, %bb3
60  %i23 = phi i64 [ %i26, %bb22 ], [ undef, %bb17 ], [ 100, %bb3 ]
61  %i24 = add nsw i64 %i23, %i4
62  %i25 = getelementptr %0, %0* %i, i64 %i24, i32 0
63  store float undef, float* %i25, align 4
64  %i26 = add nuw nsw i64 %i23, 1
65  br label %bb22
66}
67