[llvm] fe0197e - [InstCombine] Add checks for and(logicalshift(zext(x),undef),y) cases
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 12:59:54 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-07T20:59:31+01:00
New Revision: fe0197e194a64f950602fb50736b6648a9e5b2a9
URL: https://github.com/llvm/llvm-project/commit/fe0197e194a64f950602fb50736b6648a9e5b2a9
DIFF: https://github.com/llvm/llvm-project/commit/fe0197e194a64f950602fb50736b6648a9e5b2a9.diff
LOG: [InstCombine] Add checks for and(logicalshift(zext(x),undef),y) cases
Prep work before some cleanup in narrowMaskedBinOp
Added:
Modified:
llvm/test/Transforms/InstCombine/and-narrow.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/and-narrow.ll b/llvm/test/Transforms/InstCombine/and-narrow.ll
index a8661a9f7965..d53aef9ce97c 100644
--- a/llvm/test/Transforms/InstCombine/and-narrow.ll
+++ b/llvm/test/Transforms/InstCombine/and-narrow.ll
@@ -175,6 +175,16 @@ define <2 x i16> @zext_lshr_vec_overshift(<2 x i8> %x) {
ret <2 x i16> %r
}
+define <2 x i16> @zext_lshr_vec_undef(<2 x i8> %x) {
+; CHECK-LABEL: @zext_lshr_vec_undef(
+; CHECK-NEXT: ret <2 x i16> zeroinitializer
+;
+ %z = zext <2 x i8> %x to <2 x i16>
+ %b = lshr <2 x i16> %z, undef
+ %r = and <2 x i16> %b, %z
+ ret <2 x i16> %r
+}
+
; Don't create poison by narrowing a shift below the shift amount.
define <2 x i16> @zext_shl_vec_overshift(<2 x i8> %x) {
@@ -190,3 +200,13 @@ define <2 x i16> @zext_shl_vec_overshift(<2 x i8> %x) {
ret <2 x i16> %r
}
+define <2 x i16> @zext_shl_vec_undef(<2 x i8> %x) {
+; CHECK-LABEL: @zext_shl_vec_undef(
+; CHECK-NEXT: ret <2 x i16> zeroinitializer
+;
+ %z = zext <2 x i8> %x to <2 x i16>
+ %b = shl <2 x i16> %z, undef
+ %r = and <2 x i16> %b, %z
+ ret <2 x i16> %r
+}
+
More information about the llvm-commits
mailing list