[llvm] 60de144 - [InstCombine] add tests for select with frozen condition; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 18 12:14:14 PDT 2022
Author: Sanjay Patel
Date: 2022-04-18T15:14:02-04:00
New Revision: 60de144119abc5848d4fae2f502e05ffae90a970
URL: https://github.com/llvm/llvm-project/commit/60de144119abc5848d4fae2f502e05ffae90a970
DIFF: https://github.com/llvm/llvm-project/commit/60de144119abc5848d4fae2f502e05ffae90a970.diff
LOG: [InstCombine] add tests for select with frozen condition; 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 d05336bddcc6d..06ed583981710 100644
--- a/llvm/test/Transforms/InstCombine/select.ll
+++ b/llvm/test/Transforms/InstCombine/select.ll
@@ -2595,8 +2595,8 @@ define i8 @cond_freeze(i8 %x, i8 %y) {
ret i8 %s
}
-define i8 @cond_freeze2(i8 %x, i8 %y) {
-; CHECK-LABEL: @cond_freeze2(
+define i8 @cond_freeze_constant_false_val(i8 %x) {
+; CHECK-LABEL: @cond_freeze_constant_false_val(
; CHECK-NEXT: ret i8 1
;
%cond.fr = freeze i1 undef
@@ -2604,8 +2604,8 @@ define i8 @cond_freeze2(i8 %x, i8 %y) {
ret i8 %s
}
-define i8 @cond_freeze3(i8 %x) {
-; CHECK-LABEL: @cond_freeze3(
+define i8 @cond_freeze_constant_true_val(i8 %x) {
+; CHECK-LABEL: @cond_freeze_constant_true_val(
; CHECK-NEXT: ret i8 1
;
%cond.fr = freeze i1 undef
@@ -2613,8 +2613,17 @@ define i8 @cond_freeze3(i8 %x) {
ret i8 %s
}
-define <2 x i8> @cond_freeze_vec(<2 x i8> %x) {
-; CHECK-LABEL: @cond_freeze_vec(
+define i8 @cond_freeze_both_arms_constant() {
+; CHECK-LABEL: @cond_freeze_both_arms_constant(
+; CHECK-NEXT: ret i8 3
+;
+ %cond.fr = freeze i1 undef
+ %s = select i1 %cond.fr, i8 42, i8 3
+ ret i8 %s
+}
+
+define <2 x i8> @cond_freeze_constant_true_val_vec(<2 x i8> %x) {
+; CHECK-LABEL: @cond_freeze_constant_true_val_vec(
; CHECK-NEXT: ret <2 x i8> <i8 1, i8 2>
;
%cond.fr = freeze <2 x i1> <i1 undef, i1 undef>
@@ -2622,6 +2631,17 @@ define <2 x i8> @cond_freeze_vec(<2 x i8> %x) {
ret <2 x i8> %s
}
+define <2 x i8> @partial_cond_freeze_constant_true_val_vec(<2 x i8> %x) {
+; CHECK-LABEL: @partial_cond_freeze_constant_true_val_vec(
+; CHECK-NEXT: [[COND_FR:%.*]] = freeze <2 x i1> <i1 true, i1 undef>
+; CHECK-NEXT: [[S:%.*]] = select <2 x i1> [[COND_FR]], <2 x i8> <i8 1, i8 2>, <2 x i8> [[X:%.*]]
+; CHECK-NEXT: ret <2 x i8> [[S]]
+;
+ %cond.fr = freeze <2 x i1> <i1 true, i1 undef>
+ %s = select <2 x i1> %cond.fr, <2 x i8> <i8 1, i8 2>, <2 x i8> %x
+ ret <2 x i8> %s
+}
+
declare void @foo2(i8, i8)
define void @cond_freeze_multipleuses(i8 %x, i8 %y) {
More information about the llvm-commits
mailing list