[llvm] 3c83bbd - [Test] Add complementary test for umin_seq

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 03:49:15 PST 2023


Author: Max Kazantsev
Date: 2023-01-11T18:49:09+07:00
New Revision: 3c83bbd35d95dfc81b6b03171d3c0326c283f82c

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

LOG: [Test] Add complementary test for umin_seq

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/ext_min_max.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/ext_min_max.ll b/llvm/test/Analysis/ScalarEvolution/ext_min_max.ll
index d08052931cb4..304d64258500 100644
--- a/llvm/test/Analysis/ScalarEvolution/ext_min_max.ll
+++ b/llvm/test/Analysis/ScalarEvolution/ext_min_max.ll
@@ -120,3 +120,36 @@ define i1 @test_smax(i32 %x, i32 %y) {
   %they_are_same = icmp eq i64 %sext_smax_x_y, %smax_sext_x_sext_y
   ret i1 %they_are_same
 }
+
+; TODO: Make sure that zext(umin_seq(x, y)) has same SCEV as umin_seq(zext(x), zext(y)).
+; Equality proof: https://alive2.llvm.org/ce/z/X8kaNx
+define i1 @test_umin_seq(i1 %x, i1 %y) {
+; CHECK-LABEL: 'test_umin_seq'
+; CHECK-NEXT:  Classifying expressions for: @test_umin_seq
+; CHECK-NEXT:    %x_umin_seq_y = select i1 %x, i1 %y, i1 false
+; CHECK-NEXT:    --> (%x umin_seq %y) U: full-set S: full-set
+; CHECK-NEXT:    %zext_x_umin_seq_y = zext i1 %x_umin_seq_y to i64
+; CHECK-NEXT:    --> (zext i1 (%x umin_seq %y) to i64) U: [0,2) S: [0,2)
+; CHECK-NEXT:    %zext_x = zext i1 %x to i64
+; CHECK-NEXT:    --> (zext i1 %x to i64) U: [0,2) S: [0,2)
+; CHECK-NEXT:    %zext_y = zext i1 %y to i64
+; CHECK-NEXT:    --> (zext i1 %y to i64) U: [0,2) S: [0,2)
+; CHECK-NEXT:    %umin_zext_x_zext_y = select i1 %cmp_zext_x_zext_y, i64 %zext_x, i64 %zext_y
+; CHECK-NEXT:    --> ((zext i1 %x to i64) umin (zext i1 %y to i64)) U: [0,2) S: [0,2)
+; CHECK-NEXT:    %umin_seq_zext_x_xext_y = select i1 %zext_x_is_0, i64 0, i64 %umin_zext_x_zext_y
+; CHECK-NEXT:    --> ((zext i1 %x to i64) umin_seq (zext i1 %y to i64)) U: [0,2) S: [0,2)
+; CHECK-NEXT:  Determining loop execution counts for: @test_umin_seq
+;
+  %x_umin_seq_y = select i1 %x, i1 %y, i1 false
+  %zext_x_umin_seq_y = zext i1 %x_umin_seq_y to i64
+
+  %zext_x = zext i1 %x to i64
+  %zext_y = zext i1 %y to i64
+  %zext_x_is_0 = icmp eq i64 %zext_x, 0
+  %cmp_zext_x_zext_y = icmp ult i64 %zext_x, %zext_y
+  %umin_zext_x_zext_y = select i1 %cmp_zext_x_zext_y, i64 %zext_x, i64 %zext_y
+  %umin_seq_zext_x_xext_y = select i1 %zext_x_is_0, i64 0, i64 %umin_zext_x_zext_y
+
+  %they_are_same = icmp eq i64 %zext_x_umin_seq_y, %umin_seq_zext_x_xext_y
+  ret i1 %they_are_same
+}


        


More information about the llvm-commits mailing list