[llvm-branch-commits] [llvm] 109e073 - [ConstraintElimination] Add tests for select form and/or (NFC)
Juneyoung Lee via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 29 23:10:05 PST 2020
Author: Juneyoung Lee
Date: 2020-12-30T16:05:19+09:00
New Revision: 109e0736620cc3ca618e80ec3c1f2f267ee2e026
URL: https://github.com/llvm/llvm-project/commit/109e0736620cc3ca618e80ec3c1f2f267ee2e026
DIFF: https://github.com/llvm/llvm-project/commit/109e0736620cc3ca618e80ec3c1f2f267ee2e026.diff
LOG: [ConstraintElimination] Add tests for select form and/or (NFC)
Added:
Modified:
llvm/test/Transforms/ConstraintElimination/and.ll
llvm/test/Transforms/ConstraintElimination/or.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ConstraintElimination/and.ll b/llvm/test/Transforms/ConstraintElimination/and.ll
index d8962b39ebd5..c9b633049757 100644
--- a/llvm/test/Transforms/ConstraintElimination/and.ll
+++ b/llvm/test/Transforms/ConstraintElimination/and.ll
@@ -48,6 +48,72 @@ bb1:
call void @use(i1 %t.3)
+ %c.3 = icmp ule i32 %x, %a
+ call void @use(i1 %c.3)
+
+ ret i32 10
+
+exit:
+ %c.4 = icmp ule i32 %x, %z
+ call void @use(i1 %c.4)
+
+ %c.5 = icmp ule i32 %x, %a
+ call void @use(i1 %c.5)
+
+ %c.6 = icmp ule i32 %x, %y
+ call void @use(i1 %c.6)
+
+ %c.7 = icmp ule i32 %y, %z
+ call void @use(i1 %c.7)
+
+ ret i32 20
+}
+
+define i32 @test_and_select_ule(i32 %x, i32 %y, i32 %z, i32 %a) {
+; CHECK-LABEL: @test_and_select_ule(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]]
+; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 [[C_2]], i1 false
+; CHECK-NEXT: br i1 [[AND]], label [[BB1:%.*]], label [[EXIT:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[T_1]])
+; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[X]], [[Y]]
+; CHECK-NEXT: call void @use(i1 [[T_2]])
+; CHECK-NEXT: [[T_3:%.*]] = icmp ule i32 [[Y]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[T_3]])
+; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[A:%.*]]
+; CHECK-NEXT: call void @use(i1 [[C_3]])
+; CHECK-NEXT: ret i32 10
+; CHECK: exit:
+; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[C_4]])
+; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], [[A]]
+; CHECK-NEXT: call void @use(i1 [[C_5]])
+; CHECK-NEXT: [[C_6:%.*]] = icmp ule i32 [[X]], [[Y]]
+; CHECK-NEXT: call void @use(i1 [[C_6]])
+; CHECK-NEXT: [[C_7:%.*]] = icmp ule i32 [[Y]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[C_7]])
+; CHECK-NEXT: ret i32 20
+;
+entry:
+ %c.1 = icmp ule i32 %x, %y
+ %c.2 = icmp ule i32 %y, %z
+ %and = select i1 %c.1, i1 %c.2, i1 false
+ br i1 %and, label %bb1, label %exit
+
+bb1:
+ %t.1 = icmp ule i32 %x, %z
+ call void @use(i1 %t.1)
+
+ %t.2 = icmp ule i32 %x, %y
+ call void @use(i1 %t.2)
+
+ %t.3 = icmp ule i32 %y, %z
+ call void @use(i1 %t.3)
+
+
%c.3 = icmp ule i32 %x, %a
call void @use(i1 %c.3)
diff --git a/llvm/test/Transforms/ConstraintElimination/or.ll b/llvm/test/Transforms/ConstraintElimination/or.ll
index 31a1803d8621..b97887043eb9 100644
--- a/llvm/test/Transforms/ConstraintElimination/or.ll
+++ b/llvm/test/Transforms/ConstraintElimination/or.ll
@@ -62,3 +62,63 @@ exit:
ret i32 20
}
+
+define i32 @test_or_select_ule(i32 %x, i32 %y, i32 %z, i32 %a) {
+; CHECK-LABEL: @test_or_select_ule(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[Y]], [[Z:%.*]]
+; CHECK-NEXT: [[OR:%.*]] = select i1 [[C_1]], i1 true, i1 [[C_2]]
+; CHECK-NEXT: br i1 [[OR]], label [[BB1:%.*]], label [[EXIT:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[X]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[C_3]])
+; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], [[A:%.*]]
+; CHECK-NEXT: call void @use(i1 [[C_4]])
+; CHECK-NEXT: ret i32 10
+; CHECK: exit:
+; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[F_1]])
+; CHECK-NEXT: [[C_5:%.*]] = icmp ule i32 [[X]], [[A]]
+; CHECK-NEXT: call void @use(i1 [[C_5]])
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[Y]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[T_1]])
+; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i32 [[X]], [[Y]]
+; CHECK-NEXT: call void @use(i1 [[T_2]])
+; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i32 [[X]], [[Z]]
+; CHECK-NEXT: call void @use(i1 [[T_3]])
+; CHECK-NEXT: ret i32 20
+;
+entry:
+ %c.1 = icmp ule i32 %x, %y
+ %c.2 = icmp ule i32 %y, %z
+ %or = select i1 %c.1, i1 true, i1 %c.2
+ br i1 %or, label %bb1, label %exit
+
+bb1:
+ %c.3 = icmp ule i32 %x, %z
+ call void @use(i1 %c.3)
+
+ %c.4 = icmp ule i32 %x, %a
+ call void @use(i1 %c.4)
+
+ ret i32 10
+
+exit:
+ %f.1 = icmp ule i32 %x, %z
+ call void @use(i1 %f.1)
+
+ %c.5 = icmp ule i32 %x, %a
+ call void @use(i1 %c.5)
+
+ %t.1 = icmp ugt i32 %y, %z
+ call void @use(i1 %t.1)
+
+ %t.2 = icmp ugt i32 %x, %y
+ call void @use(i1 %t.2)
+
+ %t.3 = icmp ugt i32 %x, %z
+ call void @use(i1 %t.3)
+
+ ret i32 20
+}
More information about the llvm-branch-commits
mailing list