[llvm] 89d2a9d - [VPlan] Add additional FOR hoisting test.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 6 06:36:44 PDT 2024
Author: Florian Hahn
Date: 2024-10-06T14:36:33+01:00
New Revision: 89d2a9de05074bf6e538fd514228c43aed3cc72f
URL: https://github.com/llvm/llvm-project/commit/89d2a9de05074bf6e538fd514228c43aed3cc72f
DIFF: https://github.com/llvm/llvm-project/commit/89d2a9de05074bf6e538fd514228c43aed3cc72f.diff
LOG: [VPlan] Add additional FOR hoisting test.
Additional tests for https://github.com/llvm/llvm-project/pull/108945.
Added:
Modified:
llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll b/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll
index 6522ed2b52b4fb..5e4ea2c0bfc508 100644
--- a/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll
+++ b/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll
@@ -152,15 +152,36 @@ exit:
; incoming value from the previous iteration (for.x.prev) of te latter FOR (for.y).
; That means side-effecting user (store i64 %for.y.i64, ptr %gep) of the latter
; FOR (for.y) should be moved which is not currently supported.
-define i32 @test_chained_first_order_recurrences_4(ptr %base) {
+define i32 @test_chained_first_order_recurrences_4(ptr %base, i64 %x) {
; CHECK-LABEL: 'test_chained_first_order_recurrences_4'
; CHECK: No VPlans built.
-
+;
entry:
br label %loop
+loop:
+ %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
+ %for.x = phi i64 [ %for.x.next, %loop ], [ 0, %entry ]
+ %for.y = phi i32 [ %for.x.prev, %loop ], [ 0, %entry ]
+ %iv.next = add i64 %iv, 1
+ %gep = getelementptr i64, ptr %base, i64 %iv
+ %for.x.prev = trunc i64 %for.x to i32
+ %for.y.i64 = sext i32 %for.y to i64
+ store i64 %for.y.i64, ptr %gep
+ %for.x.next = mul i64 %x, 2
+ %icmp = icmp ugt i64 %iv, 4096
+ br i1 %icmp, label %ret, label %loop
+
ret:
ret i32 0
+}
+
+define i32 @test_chained_first_order_recurrences_5_hoist_to_load(ptr %base) {
+; CHECK-LABEL: 'test_chained_first_order_recurrences_5_hoist_to_load'
+; CHECK: No VPlans built.
+;
+entry:
+ br label %loop
loop:
%iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
@@ -168,10 +189,14 @@ loop:
%for.y = phi i32 [ %for.x.prev, %loop ], [ 0, %entry ]
%iv.next = add i64 %iv, 1
%gep = getelementptr i64, ptr %base, i64 %iv
+ %l = load i64, ptr %gep
%for.x.prev = trunc i64 %for.x to i32
%for.y.i64 = sext i32 %for.y to i64
store i64 %for.y.i64, ptr %gep
- %for.x.next = mul i64 0, 0
+ %for.x.next = mul i64 %l, 2
%icmp = icmp ugt i64 %iv, 4096
br i1 %icmp, label %ret, label %loop
+
+ret:
+ ret i32 0
}
More information about the llvm-commits
mailing list