[llvm] r325436 - [InstSimplify, InstCombine] add tests with vector undef elts; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 17 07:55:40 PST 2018
Author: spatel
Date: Sat Feb 17 07:55:40 2018
New Revision: 325436
URL: http://llvm.org/viewvc/llvm-project?rev=325436&view=rev
Log:
[InstSimplify, InstCombine] add tests with vector undef elts; NFC
These would fold if the m_One pattern matcher accounted for undef elts.
Modified:
llvm/trunk/test/Transforms/InstCombine/select.ll
llvm/trunk/test/Transforms/InstSimplify/icmp-bool-constant.ll
Modified: llvm/trunk/test/Transforms/InstCombine/select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=325436&r1=325435&r2=325436&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/select.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/select.ll Sat Feb 17 07:55:40 2018
@@ -54,24 +54,33 @@ define i32 @test6(i1 %C) {
; CHECK: ret i32 %V
}
-define i1 @test7(i1 %C, i1 %X) {
-; CHECK-LABEL: @test7(
-; CHECK-NEXT: [[R:%.*]] = or i1 %C, %X
+define i1 @trueval_is_true(i1 %C, i1 %X) {
+; CHECK-LABEL: @trueval_is_true(
+; CHECK-NEXT: [[R:%.*]] = or i1 [[C:%.*]], [[X:%.*]]
; CHECK-NEXT: ret i1 [[R]]
;
%R = select i1 %C, i1 true, i1 %X
ret i1 %R
}
-define <2 x i1> @test7vec(<2 x i1> %C, <2 x i1> %X) {
-; CHECK-LABEL: @test7vec(
-; CHECK-NEXT: [[R:%.*]] = or <2 x i1> %C, %X
+define <2 x i1> @trueval_is_true_vec(<2 x i1> %C, <2 x i1> %X) {
+; CHECK-LABEL: @trueval_is_true_vec(
+; CHECK-NEXT: [[R:%.*]] = or <2 x i1> [[C:%.*]], [[X:%.*]]
; CHECK-NEXT: ret <2 x i1> [[R]]
;
%R = select <2 x i1> %C, <2 x i1> <i1 true, i1 true>, <2 x i1> %X
ret <2 x i1> %R
}
+define <2 x i1> @trueval_is_true_vec_undef_elt(<2 x i1> %C, <2 x i1> %X) {
+; CHECK-LABEL: @trueval_is_true_vec_undef_elt(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[C:%.*]], <2 x i1> <i1 undef, i1 true>, <2 x i1> [[X:%.*]]
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %R = select <2 x i1> %C, <2 x i1> <i1 undef, i1 true>, <2 x i1> %X
+ ret <2 x i1> %R
+}
+
define i1 @test8(i1 %C, i1 %X) {
; CHECK-LABEL: @test8(
; CHECK-NEXT: [[R:%.*]] = and i1 %C, %X
Modified: llvm/trunk/test/Transforms/InstSimplify/icmp-bool-constant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/icmp-bool-constant.ll?rev=325436&r1=325435&r2=325436&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/icmp-bool-constant.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/icmp-bool-constant.ll Sat Feb 17 07:55:40 2018
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
; Test all integer predicates with bool types and true/false constants.
@@ -11,6 +12,15 @@ define <2 x i1> @eq_t(<2 x i1> %a) {
ret <2 x i1> %r
}
+define <2 x i1> @eq_t_undef_elt(<2 x i1> %a) {
+; CHECK-LABEL: @eq_t_undef_elt(
+; CHECK-NEXT: [[R:%.*]] = icmp eq <2 x i1> [[A:%.*]], <i1 undef, i1 true>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %r = icmp eq <2 x i1> %a, <i1 undef, i1 true>
+ ret <2 x i1> %r
+}
+
define <2 x i1> @eq_f(<2 x i1> %a) {
; CHECK-LABEL: @eq_f(
; CHECK-NEXT: [[R:%.*]] = icmp eq <2 x i1> %a, zeroinitializer
@@ -45,6 +55,15 @@ define <2 x i1> @ugt_t(<2 x i1> %a) {
ret <2 x i1> %r
}
+define <2 x i1> @ugt_t_undef_elt(<2 x i1> %a) {
+; CHECK-LABEL: @ugt_t_undef_elt(
+; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i1> [[A:%.*]], <i1 true, i1 undef>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %r = icmp ugt <2 x i1> %a, <i1 true, i1 undef>
+ ret <2 x i1> %r
+}
+
define <2 x i1> @ugt_f(<2 x i1> %a) {
; CHECK-LABEL: @ugt_f(
; CHECK-NEXT: ret <2 x i1> %a
@@ -144,6 +163,15 @@ define <2 x i1> @sge_t(<2 x i1> %a) {
ret <2 x i1> %r
}
+define <2 x i1> @sge_t_undef_elt(<2 x i1> %a) {
+; CHECK-LABEL: @sge_t_undef_elt(
+; CHECK-NEXT: [[R:%.*]] = icmp sge <2 x i1> [[A:%.*]], <i1 true, i1 undef>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %r = icmp sge <2 x i1> %a, <i1 true, i1 undef>
+ ret <2 x i1> %r
+}
+
define <2 x i1> @sge_f(<2 x i1> %a) {
; CHECK-LABEL: @sge_f(
; CHECK-NEXT: [[R:%.*]] = icmp sge <2 x i1> %a, zeroinitializer
More information about the llvm-commits
mailing list