[llvm] c52268a - [ConstraintElim] Add tests to check negated OR simplifications.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 23 13:01:36 PDT 2023
Author: Florian Hahn
Date: 2023-06-23T21:01:26+01:00
New Revision: c52268a9afe96078fde9ee778577341645465c38
URL: https://github.com/llvm/llvm-project/commit/c52268a9afe96078fde9ee778577341645465c38
DIFF: https://github.com/llvm/llvm-project/commit/c52268a9afe96078fde9ee778577341645465c38.diff
LOG: [ConstraintElim] Add tests to check negated OR simplifications.
Additional test coverage for D151799.
Added:
Modified:
llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll b/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
index 58b891f085fe5..2f0152015e235 100644
--- a/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
+++ b/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
@@ -319,3 +319,81 @@ loop.latch:
exit:
ret void
}
+
+define i1 @test_and_used_in_false_branch(i8 %x) {
+; CHECK-LABEL: @test_and_used_in_false_branch(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 5
+; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], [[T_1]]
+; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
+; CHECK: then:
+; CHECK-NEXT: ret i1 [[T_1]]
+; CHECK: else:
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+
+entry:
+ %c.1 = icmp ugt i8 %x, 10
+ %t.1 = icmp ugt i8 %x, 5
+ %and = and i1 %c.1, %t.1
+ br i1 %and, label %then, label %else
+
+then:
+ ret i1 %t.1
+
+else:
+ ret i1 %t.1
+}
+
+define i1 @test_or_used_in_false_branch(i8 %x) {
+; CHECK-LABEL: @test_or_used_in_false_branch(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10
+; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 5
+; CHECK-NEXT: [[AND:%.*]] = or i1 [[C_1]], [[T_1]]
+; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
+; CHECK: then:
+; CHECK-NEXT: ret i1 [[T_1]]
+; CHECK: else:
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+
+entry:
+ %c.1 = icmp ule i8 %x, 10
+ %t.1 = icmp ule i8 %x, 5
+ %and = or i1 %c.1, %t.1
+ br i1 %and, label %then, label %else
+
+then:
+ ret i1 %t.1
+
+else:
+ ret i1 %t.1
+}
+
+define i1 @test_or_used_in_false_branch2(i8 %x) {
+; CHECK-LABEL: @test_or_used_in_false_branch2(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 5
+; CHECK-NEXT: [[AND:%.*]] = or i1 [[C_1]], [[T_1]]
+; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
+; CHECK: then:
+; CHECK-NEXT: ret i1 [[T_1]]
+; CHECK: else:
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+
+entry:
+ %c.1 = icmp ugt i8 %x, 10
+ %t.1 = icmp ugt i8 %x, 5
+ %and = or i1 %c.1, %t.1
+ br i1 %and, label %then, label %else
+
+then:
+ ret i1 %t.1
+
+else:
+ ret i1 %t.1
+}
More information about the llvm-commits
mailing list