[llvm] 595d3b5 - [InstCombine] Add tests for select(freeze(icmp x, y), x, y); NFC
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 23:18:32 PDT 2020
Author: Juneyoung Lee
Date: 2020-08-08T15:09:08+09:00
New Revision: 595d3b5ecc59d1c89a8eefbfc37083b0d45f502f
URL: https://github.com/llvm/llvm-project/commit/595d3b5ecc59d1c89a8eefbfc37083b0d45f502f
DIFF: https://github.com/llvm/llvm-project/commit/595d3b5ecc59d1c89a8eefbfc37083b0d45f502f.diff
LOG: [InstCombine] Add tests for select(freeze(icmp x, y), x, y); NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/select.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll
index ae21c5864e5b..5d1fd76b2709 100644
--- a/llvm/test/Transforms/InstCombine/select.ll
+++ b/llvm/test/Transforms/InstCombine/select.ll
@@ -2537,3 +2537,42 @@ define void @cond_freeze_multipleuses(i8 %x, i8 %y) {
call void @foo2(i8 %s, i8 %s2)
ret void
}
+
+define i32 @select_freeze_icmp_eq(i32 %x, i32 %y) {
+; CHECK-LABEL: @select_freeze_icmp_eq(
+; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: [[C_FR:%.*]] = freeze i1 [[C]]
+; CHECK-NEXT: [[V:%.*]] = select i1 [[C_FR]], i32 [[X]], i32 [[Y]]
+; CHECK-NEXT: ret i32 [[V]]
+;
+ %c = icmp eq i32 %x, %y
+ %c.fr = freeze i1 %c
+ %v = select i1 %c.fr, i32 %x, i32 %y
+ ret i32 %v
+}
+
+define i32 @select_freeze_icmp_ne(i32 %x, i32 %y) {
+; CHECK-LABEL: @select_freeze_icmp_ne(
+; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: [[C_FR:%.*]] = freeze i1 [[C]]
+; CHECK-NEXT: [[V:%.*]] = select i1 [[C_FR]], i32 [[X]], i32 [[Y]]
+; CHECK-NEXT: ret i32 [[V]]
+;
+ %c = icmp ne i32 %x, %y
+ %c.fr = freeze i1 %c
+ %v = select i1 %c.fr, i32 %x, i32 %y
+ ret i32 %v
+}
+
+define i32 @select_freeze_icmp_else(i32 %x, i32 %y) {
+; CHECK-LABEL: @select_freeze_icmp_else(
+; CHECK-NEXT: [[C:%.*]] = icmp ult i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: [[C_FR:%.*]] = freeze i1 [[C]]
+; CHECK-NEXT: [[V:%.*]] = select i1 [[C_FR]], i32 [[X]], i32 [[Y]]
+; CHECK-NEXT: ret i32 [[V]]
+;
+ %c = icmp ult i32 %x, %y
+ %c.fr = freeze i1 %c
+ %v = select i1 %c.fr, i32 %x, i32 %y
+ ret i32 %v
+}
More information about the llvm-commits
mailing list