[llvm] d93eb3a - [Test] Add test for logical_and, rename old one into logical_or
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 00:27:41 PST 2022
Author: Max Kazantsev
Date: 2022-12-08T15:27:34+07:00
New Revision: d93eb3a942d83029e4cc68354e3e441db957bf1b
URL: https://github.com/llvm/llvm-project/commit/d93eb3a942d83029e4cc68354e3e441db957bf1b
DIFF: https://github.com/llvm/llvm-project/commit/d93eb3a942d83029e4cc68354e3e441db957bf1b.diff
LOG: [Test] Add test for logical_and, rename old one into logical_or
Added:
Modified:
llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll b/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll
index be31a2f484e0..c85582fb294b 100644
--- a/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll
+++ b/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll
@@ -512,10 +512,10 @@ failed_2:
ret i32 -2
}
-; TODO: Symbolic max can be start1 umin_seq start2
-define i32 @test_two_phis_logical_and(i32 %start_1, i32 %start_2, i32 %len) {
-; CHECK-LABEL: 'test_two_phis_logical_and'
-; CHECK-NEXT: Classifying expressions for: @test_two_phis_logical_and
+; TODO: Symbolic max can be start1 umax_seq start2
+define i32 @test_two_phis_logical_or(i32 %start_1, i32 %start_2, i32 %len) {
+; CHECK-LABEL: 'test_two_phis_logical_or'
+; CHECK-NEXT: Classifying expressions for: @test_two_phis_logical_or
; CHECK-NEXT: %iv_1 = phi i32 [ %start_1, %entry ], [ %iv_1.next, %backedge ]
; CHECK-NEXT: --> {%start_1,+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv_2 = phi i32 [ %start_2, %entry ], [ %iv_2.next, %backedge ]
@@ -538,7 +538,7 @@ define i32 @test_two_phis_logical_and(i32 %start_1, i32 %start_2, i32 %len) {
; CHECK-NEXT: --> {(-1 + %start_2),+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %loop_cond = call i1 @cond()
; CHECK-NEXT: --> %loop_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
-; CHECK-NEXT: Determining loop execution counts for: @test_two_phis_logical_and
+; CHECK-NEXT: Determining loop execution counts for: @test_two_phis_logical_or
; CHECK-NEXT: Loop %loop: <multiple exits> Unpredictable backedge-taken count.
; CHECK-NEXT: exit count for loop: ***COULDNOTCOMPUTE***
; CHECK-NEXT: exit count for range_check_block: ***COULDNOTCOMPUTE***
@@ -585,3 +585,77 @@ failed_1:
failed_2:
ret i32 -2
}
+
+; TODO: Symbolic max can be start1 umin_seq start2
+define i32 @test_two_phis_logical_and(i32 %start_1, i32 %start_2, i32 %len) {
+; CHECK-LABEL: 'test_two_phis_logical_and'
+; CHECK-NEXT: Classifying expressions for: @test_two_phis_logical_and
+; CHECK-NEXT: %iv_1 = phi i32 [ %start_1, %entry ], [ %iv_1.next, %backedge ]
+; CHECK-NEXT: --> {%start_1,+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: %iv_2 = phi i32 [ %start_2, %entry ], [ %iv_2.next, %backedge ]
+; CHECK-NEXT: --> {%start_2,+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: %scam_1 = call i1 @cond()
+; CHECK-NEXT: --> %scam_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT: %c1 = and i1 %zero_check_1, %scam_1
+; CHECK-NEXT: --> (%zero_check_1 umin %scam_1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT: %scam_2 = call i1 @cond()
+; CHECK-NEXT: --> %scam_2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT: %c2 = and i1 %zero_check_2, %scam_2
+; CHECK-NEXT: --> (%zero_check_2 umin %scam_2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT: %merged_cond = select i1 %c1, i1 %c2, i1 false
+; CHECK-NEXT: --> ((%zero_check_1 umin %scam_1) umin_seq (%zero_check_2 umin %scam_2)) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT: %iv.minus.1 = add i32 %iv_1, -1
+; CHECK-NEXT: --> {(-1 + %start_1),+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: %iv_1.next = add i32 %iv_1, -1
+; CHECK-NEXT: --> {(-1 + %start_1),+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: %iv_2.next = add i32 %iv_2, -1
+; CHECK-NEXT: --> {(-1 + %start_2),+,-1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: %loop_cond = call i1 @cond()
+; CHECK-NEXT: --> %loop_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT: Determining loop execution counts for: @test_two_phis_logical_and
+; CHECK-NEXT: Loop %loop: <multiple exits> Unpredictable backedge-taken count.
+; CHECK-NEXT: exit count for loop: ***COULDNOTCOMPUTE***
+; CHECK-NEXT: exit count for range_check_block: ***COULDNOTCOMPUTE***
+; CHECK-NEXT: exit count for backedge: ***COULDNOTCOMPUTE***
+; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
+; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is -1
+; CHECK-NEXT: symbolic max exit count for loop: -1
+; CHECK-NEXT: symbolic max exit count for range_check_block: ***COULDNOTCOMPUTE***
+; CHECK-NEXT: symbolic max exit count for backedge: ***COULDNOTCOMPUTE***
+; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
+;
+entry:
+ br label %loop
+
+loop:
+ %iv_1 = phi i32 [%start_1, %entry], [%iv_1.next, %backedge]
+ %iv_2 = phi i32 [%start_2, %entry], [%iv_2.next, %backedge]
+ %scam_1 = call i1 @cond()
+ %zero_check_1 = icmp ne i32 %iv_1, 0
+ %c1 = and i1 %zero_check_1, %scam_1
+ %scam_2 = call i1 @cond()
+ %zero_check_2 = icmp ne i32 %iv_2, 0
+ %c2 = and i1 %zero_check_2, %scam_2
+ %merged_cond = select i1 %c1, i1 %c2, i1 false
+ br i1 %merged_cond, label %range_check_block, label %failed_1
+
+range_check_block:
+ %iv.minus.1 = add i32 %iv_1, -1
+ %range_check = icmp ult i32 %iv.minus.1, %len
+ br i1 %range_check, label %backedge, label %failed_2
+
+backedge:
+ %iv_1.next = add i32 %iv_1, -1
+ %iv_2.next = add i32 %iv_2, -1
+ %loop_cond = call i1 @cond()
+ br i1 %loop_cond, label %done, label %loop
+
+done:
+ ret i32 %iv_2
+
+failed_1:
+ ret i32 -1
+
+failed_2:
+ ret i32 -2
+}
More information about the llvm-commits
mailing list