@@ -152,26 +152,51 @@ exit:
152
152
; incoming value from the previous iteration (for.x.prev) of te latter FOR (for.y).
153
153
; That means side-effecting user (store i64 %for.y.i64, ptr %gep) of the latter
154
154
; FOR (for.y) should be moved which is not currently supported.
155
- define i32 @test_chained_first_order_recurrences_4 (ptr %base ) {
155
+ define i32 @test_chained_first_order_recurrences_4 (ptr %base , i64 %x ) {
156
156
; CHECK-LABEL: 'test_chained_first_order_recurrences_4'
157
157
; CHECK: No VPlans built.
158
-
158
+ ;
159
159
entry:
160
160
br label %loop
161
161
162
+ loop:
163
+ %iv = phi i64 [ %iv.next , %loop ], [ 0 , %entry ]
164
+ %for.x = phi i64 [ %for.x.next , %loop ], [ 0 , %entry ]
165
+ %for.y = phi i32 [ %for.x.prev , %loop ], [ 0 , %entry ]
166
+ %iv.next = add i64 %iv , 1
167
+ %gep = getelementptr i64 , ptr %base , i64 %iv
168
+ %for.x.prev = trunc i64 %for.x to i32
169
+ %for.y.i64 = sext i32 %for.y to i64
170
+ store i64 %for.y.i64 , ptr %gep
171
+ %for.x.next = mul i64 %x , 2
172
+ %icmp = icmp ugt i64 %iv , 4096
173
+ br i1 %icmp , label %ret , label %loop
174
+
162
175
ret:
163
176
ret i32 0
177
+ }
178
+
179
+ define i32 @test_chained_first_order_recurrences_5_hoist_to_load (ptr %base ) {
180
+ ; CHECK-LABEL: 'test_chained_first_order_recurrences_5_hoist_to_load'
181
+ ; CHECK: No VPlans built.
182
+ ;
183
+ entry:
184
+ br label %loop
164
185
165
186
loop:
166
187
%iv = phi i64 [ %iv.next , %loop ], [ 0 , %entry ]
167
188
%for.x = phi i64 [ %for.x.next , %loop ], [ 0 , %entry ]
168
189
%for.y = phi i32 [ %for.x.prev , %loop ], [ 0 , %entry ]
169
190
%iv.next = add i64 %iv , 1
170
191
%gep = getelementptr i64 , ptr %base , i64 %iv
192
+ %l = load i64 , ptr %gep
171
193
%for.x.prev = trunc i64 %for.x to i32
172
194
%for.y.i64 = sext i32 %for.y to i64
173
195
store i64 %for.y.i64 , ptr %gep
174
- %for.x.next = mul i64 0 , 0
196
+ %for.x.next = mul i64 %l , 2
175
197
%icmp = icmp ugt i64 %iv , 4096
176
198
br i1 %icmp , label %ret , label %loop
199
+
200
+ ret:
201
+ ret i32 0
177
202
}
0 commit comments