[llvm] 94944f8 - [InstSimplify] add tests for select-of-bool; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 30 06:17:35 PST 2022
Author: Sanjay Patel
Date: 2022-12-30T08:54:08-05:00
New Revision: 94944f800c1242e0375b4a658820a366445e7bc1
URL: https://github.com/llvm/llvm-project/commit/94944f800c1242e0375b4a658820a366445e7bc1
DIFF: https://github.com/llvm/llvm-project/commit/94944f800c1242e0375b4a658820a366445e7bc1.diff
LOG: [InstSimplify] add tests for select-of-bool; NFC
Added:
Modified:
llvm/test/Transforms/InstSimplify/select-logical.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/select-logical.ll b/llvm/test/Transforms/InstSimplify/select-logical.ll
index 70e5a55f2fa60..1d1ee58eb939c 100644
--- a/llvm/test/Transforms/InstSimplify/select-logical.ll
+++ b/llvm/test/Transforms/InstSimplify/select-logical.ll
@@ -553,3 +553,39 @@ define i1 @select_and_same_op_negative(i1 %x, i1 %y, i1 %z) {
%r = select i1 %a, i1 %x, i1 %z
ret i1 %r
}
+
+define i1 @and_same_op(i1 %x) {
+; CHECK-LABEL: @and_same_op(
+; CHECK-NEXT: [[R:%.*]] = select i1 [[X:%.*]], i1 [[X]], i1 false
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %r = select i1 %x, i1 %x, i1 false
+ ret i1 %r
+}
+
+define <2 x i1> @or_same_op(<2 x i1> %x) {
+; CHECK-LABEL: @or_same_op(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[X:%.*]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[X]]
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %r = select <2 x i1> %x, <2 x i1> <i1 true, i1 true>, <2 x i1> %x
+ ret <2 x i1> %r
+}
+
+define <2 x i1> @always_true_same_op(<2 x i1> %x) {
+; CHECK-LABEL: @always_true_same_op(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[X:%.*]], <2 x i1> [[X]], <2 x i1> <i1 poison, i1 true>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %r = select <2 x i1> %x, <2 x i1> %x, <2 x i1> <i1 poison, i1 true>
+ ret <2 x i1> %r
+}
+
+define i1 @always_false_same_op(i1 %x) {
+; CHECK-LABEL: @always_false_same_op(
+; CHECK-NEXT: [[R:%.*]] = select i1 [[X:%.*]], i1 false, i1 [[X]]
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %r = select i1 %x, i1 false, i1 %x
+ ret i1 %r
+}
More information about the llvm-commits
mailing list