[llvm] ff5ae94 - [LV] Add variation of test cases with order of phis flipped.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 03:38:36 PDT 2022


Author: Florian Hahn
Date: 2022-08-01T11:38:16+01:00
New Revision: ff5ae948a72307fcd6b3be9ddf2d3b9349e02caf

URL: https://github.com/llvm/llvm-project/commit/ff5ae948a72307fcd6b3be9ddf2d3b9349e02caf
DIFF: https://github.com/llvm/llvm-project/commit/ff5ae948a72307fcd6b3be9ddf2d3b9349e02caf.diff

LOG: [LV] Add variation of test cases with order of phis flipped.

Additional tests with integer and pointer inductions for
D119661.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll b/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll
index df8cb46b0daa..fb11fbf32a8c 100644
--- a/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll
+++ b/llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll
@@ -71,7 +71,6 @@ exit:
   ret void
 }
 
-
 define void @test_cyclic_phis(ptr %ptr) {
 ; CHECK-LABEL: @test_cyclic_phis
 ; CHECK-NOT: vector.body:
@@ -232,7 +231,6 @@ exit:
   ret void
 }
 
-
 define void @test_chained_first_order_recurrence_sink_users_1(double* %ptr) {
 ; CHECK-LABEL: @test_chained_first_order_recurrence_sink_users_1
 ; CHECK-NOT: vector.body:
@@ -285,7 +283,6 @@ exit:
 define void @test_first_order_recurrences_and_induction(ptr %ptr) {
 ; CHECK-LABEL: @test_first_order_recurrences_and_induction(
 ; CHECK-NOT:   vector.body:
-
 ;
 entry:
   br label %loop
@@ -304,3 +301,73 @@ loop:
 exit:
   ret void
 }
+
+; Same as @test_first_order_recurrences_and_induction but with order of phis
+; flipped.
+define void @test_first_order_recurrences_and_induction2(ptr %ptr) {
+; CHECK-LABEL: @test_first_order_recurrences_and_induction2(
+; CHECK-NOT:   vector.body:
+;
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %for.1 = phi i64 [ 22, %entry ], [ %iv, %loop ]
+  %iv.next = add nuw nsw i64 %iv, 1
+  %gep.ptr = getelementptr inbounds i64, ptr %ptr, i64 %iv
+  %for.1.next = load i64, ptr %gep.ptr, align 2
+  %add.1 = add i64 %for.1, 10
+  store i64 %add.1, ptr %gep.ptr
+  %exitcond.not = icmp eq i64 %iv.next, 1000
+  br i1 %exitcond.not, label %exit, label %loop
+
+exit:
+  ret void
+}
+
+define void @test_first_order_recurrences_and_pointer_induction1(ptr %ptr) {
+; CHECK-LABEL: @test_first_order_recurrences_and_pointer_induction1(
+; CHECK-NOT: vector.body
+;
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %for.1 = phi ptr [ null, %entry ], [ %ptr.iv, %loop ]
+  %ptr.iv = phi ptr [ %ptr, %entry ], [ %ptr.iv.next, %loop ]
+  %iv.next = add nuw nsw i64 %iv, 1
+  %gep.ptr = getelementptr inbounds ptr, ptr %ptr, i64 %iv
+  store ptr %ptr.iv, ptr %gep.ptr
+  %ptr.iv.next = getelementptr i32, ptr %ptr.iv, i64 1
+  %exitcond.not = icmp eq i64 %iv.next, 1000
+  br i1 %exitcond.not, label %exit, label %loop
+
+exit:
+  ret void
+}
+
+; same as @test_first_order_recurrences_and_pointer_induction1 but with order
+; of phis flipped.
+define void @test_first_order_recurrences_and_pointer_induction2(ptr %ptr) {
+; CHECK-LABEL: @test_first_order_recurrences_and_pointer_induction2(
+; CHECK-NOT: vector.body
+;
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %ptr.iv = phi ptr [ %ptr, %entry ], [ %ptr.iv.next, %loop ]
+  %for.1 = phi ptr [ null, %entry ], [ %ptr.iv, %loop ]
+  %iv.next = add nuw nsw i64 %iv, 1
+  %gep.ptr = getelementptr inbounds ptr, ptr %ptr, i64 %iv
+  store ptr %ptr.iv, ptr %gep.ptr
+  %ptr.iv.next = getelementptr i32, ptr %ptr.iv, i64 1
+  %exitcond.not = icmp eq i64 %iv.next, 1000
+  br i1 %exitcond.not, label %exit, label %loop
+
+exit:
+  ret void
+}


        


More information about the llvm-commits mailing list