[llvm] 5f7c385 - [InstCombine] add tests for freeze of partial undef vector constants; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 09:57:42 PDT 2022


Author: Sanjay Patel
Date: 2022-04-19T12:41:50-04:00
New Revision: 5f7c38549869e15f898482a398fd4fb3ea44c6fe

URL: https://github.com/llvm/llvm-project/commit/5f7c38549869e15f898482a398fd4fb3ea44c6fe
DIFF: https://github.com/llvm/llvm-project/commit/5f7c38549869e15f898482a398fd4fb3ea44c6fe.diff

LOG: [InstCombine] add tests for freeze of partial undef vector constants; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/freeze.ll
    llvm/test/Transforms/InstCombine/select.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/freeze.ll b/llvm/test/Transforms/InstCombine/freeze.ll
index 9f2c47c7506e0..3fee57ac0c022 100644
--- a/llvm/test/Transforms/InstCombine/freeze.ll
+++ b/llvm/test/Transforms/InstCombine/freeze.ll
@@ -87,6 +87,15 @@ define void @or_select_multipleuses_logical(i32 %x, i1 %y) {
   ret void
 }
 
+define <3 x i4> @partial_undef_vec() {
+; CHECK-LABEL: @partial_undef_vec(
+; CHECK-NEXT:    [[F:%.*]] = freeze <3 x i4> <i4 poison, i4 1, i4 undef>
+; CHECK-NEXT:    ret <3 x i4> [[F]]
+;
+  %f = freeze <3 x i4> <i4 poison, i4 1, i4 undef>
+  ret <3 x i4> %f
+}
+
 ; Move the freeze forward to prevent poison from spreading.
 
 define i32 @early_freeze_test1(i32 %x, i32 %y) {
@@ -267,8 +276,8 @@ define i32 @propagate_drop_flags_mul(i32 %arg) {
 define i32 @propagate_drop_flags_udiv(i32 %arg) {
 ; CHECK-LABEL: @propagate_drop_flags_udiv(
 ; CHECK-NEXT:    [[ARG_FR:%.*]] = freeze i32 [[ARG:%.*]]
-; CHECK-NEXT:    [[V1:%.*]] = lshr i32 [[ARG_FR]], 1
-; CHECK-NEXT:    ret i32 [[V1]]
+; CHECK-NEXT:    [[V11:%.*]] = lshr i32 [[ARG_FR]], 1
+; CHECK-NEXT:    ret i32 [[V11]]
 ;
   %v1 = udiv exact i32 %arg, 2
   %v1.fr = freeze i32 %v1

diff  --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll
index 170591378ea40..e68c8e5432605 100644
--- a/llvm/test/Transforms/InstCombine/select.ll
+++ b/llvm/test/Transforms/InstCombine/select.ll
@@ -2642,6 +2642,28 @@ define <2 x i8> @partial_cond_freeze_constant_true_val_vec(<2 x i8> %x) {
   ret <2 x i8> %s
 }
 
+define <2 x i8> @partial_cond_freeze_constant_false_val_vec(<2 x i8> %x) {
+; CHECK-LABEL: @partial_cond_freeze_constant_false_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> [[X:%.*]], <2 x i8> <i8 1, i8 2>
+; 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> %x, <2 x i8> <i8 1, i8 2>
+  ret <2 x i8> %s
+}
+
+define <2 x i8> @partial_cond_freeze_both_arms_constant_vec() {
+; CHECK-LABEL: @partial_cond_freeze_both_arms_constant_vec(
+; CHECK-NEXT:    [[COND_FR:%.*]] = freeze <2 x i1> <i1 false, i1 undef>
+; CHECK-NEXT:    [[S:%.*]] = select <2 x i1> [[COND_FR]], <2 x i8> <i8 1, i8 2>, <2 x i8> <i8 42, i8 43>
+; CHECK-NEXT:    ret <2 x i8> [[S]]
+;
+  %cond.fr = freeze <2 x i1> <i1 false, i1 undef>
+  %s = select <2 x i1> %cond.fr, <2 x i8> <i8 1, i8 2>, <2 x i8> <i8 42, i8 43>
+  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