From: Sanjay Patel Date: Mon, 18 Apr 2022 18:45:18 +0000 (-0400) Subject: [InstCombine] add tests for select with frozen condition; NFC X-Git-Tag: upstream/15.0.7~10136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60de144119abc5848d4fae2f502e05ffae90a970;p=platform%2Fupstream%2Fllvm.git [InstCombine] add tests for select with frozen condition; NFC --- diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll index d05336b..06ed583 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> ; %cond.fr = freeze <2 x i1> @@ -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> +; CHECK-NEXT: [[S:%.*]] = select <2 x i1> [[COND_FR]], <2 x i8> , <2 x i8> [[X:%.*]] +; CHECK-NEXT: ret <2 x i8> [[S]] +; + %cond.fr = freeze <2 x i1> + %s = select <2 x i1> %cond.fr, <2 x i8> , <2 x i8> %x + ret <2 x i8> %s +} + declare void @foo2(i8, i8) define void @cond_freeze_multipleuses(i8 %x, i8 %y) {