Skip to content

Commit 89d2a9d

Browse files
committed
[VPlan] Add additional FOR hoisting test.
Additional tests for #108945.
1 parent fb0ef6b commit 89d2a9d

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,51 @@ exit:
152152
; incoming value from the previous iteration (for.x.prev) of te latter FOR (for.y).
153153
; That means side-effecting user (store i64 %for.y.i64, ptr %gep) of the latter
154154
; 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) {
156156
; CHECK-LABEL: 'test_chained_first_order_recurrences_4'
157157
; CHECK: No VPlans built.
158-
158+
;
159159
entry:
160160
br label %loop
161161

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+
162175
ret:
163176
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
164185

165186
loop:
166187
%iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
167188
%for.x = phi i64 [ %for.x.next, %loop ], [ 0, %entry ]
168189
%for.y = phi i32 [ %for.x.prev, %loop ], [ 0, %entry ]
169190
%iv.next = add i64 %iv, 1
170191
%gep = getelementptr i64, ptr %base, i64 %iv
192+
%l = load i64, ptr %gep
171193
%for.x.prev = trunc i64 %for.x to i32
172194
%for.y.i64 = sext i32 %for.y to i64
173195
store i64 %for.y.i64, ptr %gep
174-
%for.x.next = mul i64 0, 0
196+
%for.x.next = mul i64 %l, 2
175197
%icmp = icmp ugt i64 %iv, 4096
176198
br i1 %icmp, label %ret, label %loop
199+
200+
ret:
201+
ret i32 0
177202
}

0 commit comments

Comments
 (0)