1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt "-passes=print<scalar-evolution>,loop-unroll-and-jam" -verify-scev -S < %s | FileCheck %s
4 ; Checks that we forget scalar evolution loops and dispositions, which allows
5 ; scalar evolution to verify successfully. `print<scalar-evolution>` is needed
6 ; to populate SCEV caches.
8 target datalayout = "e-m:e-i64:64-p:64:64-n32:64-S128-v256:256:256-v512:512:512"
10 define dso_local void @main() {
13 ; CHECK-NEXT: [[X:%.*]] = alloca [216 x float], align 4
14 ; CHECK-NEXT: [[Y:%.*]] = alloca [216 x float], align 4
15 ; CHECK-NEXT: [[X_IX_DIM_0:%.*]] = getelementptr i8, ptr [[X]], i64 -52
16 ; CHECK-NEXT: [[Y_IX_DIM_0:%.*]] = getelementptr i8, ptr [[Y]], i64 -52
17 ; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
18 ; CHECK: outer.header:
19 ; CHECK-NEXT: [[X_IX_DIM_1:%.*]] = getelementptr i8, ptr [[X_IX_DIM_0]], i64 20
20 ; CHECK-NEXT: [[Y_IX_DIM_1:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_0]], i64 4
21 ; CHECK-NEXT: [[X_IX_DIM_1_1:%.*]] = getelementptr i8, ptr [[X_IX_DIM_0]], i64 20
22 ; CHECK-NEXT: [[Y_IX_DIM_1_1:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_0]], i64 8
23 ; CHECK-NEXT: [[X_IX_DIM_1_2:%.*]] = getelementptr i8, ptr [[X_IX_DIM_0]], i64 20
24 ; CHECK-NEXT: [[Y_IX_DIM_1_2:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_0]], i64 12
25 ; CHECK-NEXT: [[X_IX_DIM_1_3:%.*]] = getelementptr i8, ptr [[X_IX_DIM_0]], i64 20
26 ; CHECK-NEXT: [[Y_IX_DIM_1_3:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_0]], i64 16
27 ; CHECK-NEXT: [[X_IX_DIM_1_4:%.*]] = getelementptr i8, ptr [[X_IX_DIM_0]], i64 20
28 ; CHECK-NEXT: [[Y_IX_DIM_1_4:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_0]], i64 20
29 ; CHECK-NEXT: [[X_IX_DIM_1_5:%.*]] = getelementptr i8, ptr [[X_IX_DIM_0]], i64 20
30 ; CHECK-NEXT: [[Y_IX_DIM_1_5:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_0]], i64 24
31 ; CHECK-NEXT: br label [[INNER:%.*]]
33 ; CHECK-NEXT: [[INNER_IV_1:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ 0, [[INNER]] ]
34 ; CHECK-NEXT: [[INNER_IV:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ [[INNER_IV_NEXT:%.*]], [[INNER]] ]
35 ; CHECK-NEXT: [[INNER_IV_1_1:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ 0, [[INNER]] ]
36 ; CHECK-NEXT: [[INNER_IV_11:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ [[INNER_IV_NEXT_1:%.*]], [[INNER]] ]
37 ; CHECK-NEXT: [[INNER_IV_1_2:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ 0, [[INNER]] ]
38 ; CHECK-NEXT: [[INNER_IV_2:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ [[INNER_IV_NEXT_2:%.*]], [[INNER]] ]
39 ; CHECK-NEXT: [[INNER_IV_1_3:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ 0, [[INNER]] ]
40 ; CHECK-NEXT: [[INNER_IV_3:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ [[INNER_IV_NEXT_3:%.*]], [[INNER]] ]
41 ; CHECK-NEXT: [[INNER_IV_1_4:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ 0, [[INNER]] ]
42 ; CHECK-NEXT: [[INNER_IV_4:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ [[INNER_IV_NEXT_4:%.*]], [[INNER]] ]
43 ; CHECK-NEXT: [[INNER_IV_1_5:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ 0, [[INNER]] ]
44 ; CHECK-NEXT: [[INNER_IV_5:%.*]] = phi i64 [ 1, [[OUTER_HEADER]] ], [ [[INNER_IV_NEXT_5:%.*]], [[INNER]] ]
45 ; CHECK-NEXT: [[_IX_X_LEN:%.*]] = mul nuw nsw i64 [[INNER_IV_1]], 144
46 ; CHECK-NEXT: [[X_IX_DIM_2:%.*]] = getelementptr i8, ptr [[X_IX_DIM_1]], i64 [[_IX_X_LEN]]
47 ; CHECK-NEXT: [[Y_IX_DIM_2:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_1]], i64 [[_IX_X_LEN]]
48 ; CHECK-NEXT: [[_VAL_Y:%.*]] = load float, ptr [[Y_IX_DIM_2]], align 4
49 ; CHECK-NEXT: store float [[_VAL_Y]], ptr [[X_IX_DIM_2]], align 8
50 ; CHECK-NEXT: [[INNER_IV_NEXT]] = add nuw nsw i64 [[INNER_IV]], 1
51 ; CHECK-NEXT: [[_IX_X_LEN_12:%.*]] = mul nuw nsw i64 [[INNER_IV_1_1]], 144
52 ; CHECK-NEXT: [[X_IX_DIM_2_1:%.*]] = getelementptr i8, ptr [[X_IX_DIM_1_1]], i64 [[_IX_X_LEN_12]]
53 ; CHECK-NEXT: [[Y_IX_DIM_2_1:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_1_1]], i64 [[_IX_X_LEN_12]]
54 ; CHECK-NEXT: [[_VAL_Y_1:%.*]] = load float, ptr [[Y_IX_DIM_2_1]], align 4
55 ; CHECK-NEXT: store float [[_VAL_Y_1]], ptr [[X_IX_DIM_2_1]], align 8
56 ; CHECK-NEXT: [[INNER_IV_NEXT_1]] = add nuw nsw i64 [[INNER_IV_11]], 1
57 ; CHECK-NEXT: [[_IX_X_LEN_2:%.*]] = mul nuw nsw i64 [[INNER_IV_1_2]], 144
58 ; CHECK-NEXT: [[X_IX_DIM_2_2:%.*]] = getelementptr i8, ptr [[X_IX_DIM_1_2]], i64 [[_IX_X_LEN_2]]
59 ; CHECK-NEXT: [[Y_IX_DIM_2_2:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_1_2]], i64 [[_IX_X_LEN_2]]
60 ; CHECK-NEXT: [[_VAL_Y_2:%.*]] = load float, ptr [[Y_IX_DIM_2_2]], align 4
61 ; CHECK-NEXT: store float [[_VAL_Y_2]], ptr [[X_IX_DIM_2_2]], align 8
62 ; CHECK-NEXT: [[INNER_IV_NEXT_2]] = add nuw nsw i64 [[INNER_IV_2]], 1
63 ; CHECK-NEXT: [[_IX_X_LEN_3:%.*]] = mul nuw nsw i64 [[INNER_IV_1_3]], 144
64 ; CHECK-NEXT: [[X_IX_DIM_2_3:%.*]] = getelementptr i8, ptr [[X_IX_DIM_1_3]], i64 [[_IX_X_LEN_3]]
65 ; CHECK-NEXT: [[Y_IX_DIM_2_3:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_1_3]], i64 [[_IX_X_LEN_3]]
66 ; CHECK-NEXT: [[_VAL_Y_3:%.*]] = load float, ptr [[Y_IX_DIM_2_3]], align 4
67 ; CHECK-NEXT: store float [[_VAL_Y_3]], ptr [[X_IX_DIM_2_3]], align 8
68 ; CHECK-NEXT: [[INNER_IV_NEXT_3]] = add nuw nsw i64 [[INNER_IV_3]], 1
69 ; CHECK-NEXT: [[_IX_X_LEN_4:%.*]] = mul nuw nsw i64 [[INNER_IV_1_4]], 144
70 ; CHECK-NEXT: [[X_IX_DIM_2_4:%.*]] = getelementptr i8, ptr [[X_IX_DIM_1_4]], i64 [[_IX_X_LEN_4]]
71 ; CHECK-NEXT: [[Y_IX_DIM_2_4:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_1_4]], i64 [[_IX_X_LEN_4]]
72 ; CHECK-NEXT: [[_VAL_Y_4:%.*]] = load float, ptr [[Y_IX_DIM_2_4]], align 4
73 ; CHECK-NEXT: store float [[_VAL_Y_4]], ptr [[X_IX_DIM_2_4]], align 8
74 ; CHECK-NEXT: [[INNER_IV_NEXT_4]] = add nuw nsw i64 [[INNER_IV_4]], 1
75 ; CHECK-NEXT: [[_IX_X_LEN_5:%.*]] = mul nuw nsw i64 [[INNER_IV_1_5]], 144
76 ; CHECK-NEXT: [[X_IX_DIM_2_5:%.*]] = getelementptr i8, ptr [[X_IX_DIM_1_5]], i64 [[_IX_X_LEN_5]]
77 ; CHECK-NEXT: [[Y_IX_DIM_2_5:%.*]] = getelementptr i8, ptr [[Y_IX_DIM_1_5]], i64 [[_IX_X_LEN_5]]
78 ; CHECK-NEXT: [[_VAL_Y_5:%.*]] = load float, ptr [[Y_IX_DIM_2_5]], align 4
79 ; CHECK-NEXT: store float [[_VAL_Y_5]], ptr [[X_IX_DIM_2_5]], align 8
80 ; CHECK-NEXT: [[INNER_IV_NEXT_5]] = add nuw nsw i64 [[INNER_IV_5]], 1
81 ; CHECK-NEXT: [[EXITCOND_NOT_5:%.*]] = icmp eq i64 [[INNER_IV_NEXT_5]], 7
82 ; CHECK-NEXT: br i1 [[EXITCOND_NOT_5]], label [[OUTER_LATCH:%.*]], label [[INNER]]
84 ; CHECK-NEXT: br label [[EXIT:%.*]]
86 ; CHECK-NEXT: ret void
89 %x = alloca [216 x float], align 4
90 %y = alloca [216 x float], align 4
91 %x_ix_dim_0 = getelementptr i8, ptr %x, i64 -52
92 %y_ix_dim_0 = getelementptr i8, ptr %y, i64 -52
93 br label %outer.header
95 outer.header: ; preds = %outer.latch, %entry
96 %outer.iv = phi i64 [ 1, %entry ], [ %outer.iv.next, %outer.latch ]
97 %_ix_x_len.1 = shl nuw nsw i64 %outer.iv, 2
98 %x_ix_dim_1 = getelementptr i8, ptr %x_ix_dim_0, i64 20
99 %y_ix_dim_1 = getelementptr i8, ptr %y_ix_dim_0, i64 %_ix_x_len.1
102 inner: ; preds = %inner, %outer.header
103 %inner.iv.1 = phi i64 [ 1, %outer.header ], [ 0, %inner ]
104 %inner.iv = phi i64 [ 1, %outer.header ], [ %inner.iv.next, %inner ]
105 %_ix_x_len = mul nuw nsw i64 %inner.iv.1, 144
106 %x_ix_dim_2 = getelementptr i8, ptr %x_ix_dim_1, i64 %_ix_x_len
107 %y_ix_dim_2 = getelementptr i8, ptr %y_ix_dim_1, i64 %_ix_x_len
108 %_val_y = load float, ptr %y_ix_dim_2, align 4
109 %_add_tmp = fadd fast float %_val_y, 0.000000e+00
110 store float %_add_tmp, ptr %x_ix_dim_2, align 8
111 %inner.iv.next = add nuw nsw i64 %inner.iv, 1
112 %exitcond.not = icmp eq i64 %inner.iv.next, 7
113 br i1 %exitcond.not, label %outer.latch, label %inner
115 outer.latch: ; preds = %inner
116 %outer.iv.next = add nuw nsw i64 %outer.iv, 1
117 %exitcond.not.1 = icmp eq i64 %outer.iv.next, 7
118 br i1 %exitcond.not.1, label %exit, label %outer.header, !llvm.loop !1
120 exit: ; preds = %outer.latch
124 !1 = distinct !{!1, !2}
125 !2 = !{!"llvm.loop.unroll_and_jam.enable"}