diff --git a/llvm/lib/Analysis/CmpInstAnalysis.cpp b/llvm/lib/Analysis/CmpInstAnalysis.cpp --- a/llvm/lib/Analysis/CmpInstAnalysis.cpp +++ b/llvm/lib/Analysis/CmpInstAnalysis.cpp @@ -79,7 +79,7 @@ using namespace PatternMatch; const APInt *C; - if (!match(RHS, m_APInt(C))) + if (!match(RHS, m_APIntAllowUndef(C))) return false; switch (Pred) { diff --git a/llvm/test/Transforms/InstCombine/icmp-logical.ll b/llvm/test/Transforms/InstCombine/icmp-logical.ll --- a/llvm/test/Transforms/InstCombine/icmp-logical.ll +++ b/llvm/test/Transforms/InstCombine/icmp-logical.ll @@ -378,11 +378,8 @@ } define <2 x i1> @nomask_splat_and_B_allones(<2 x i32> %A) { -; CHECK-LABEL: @nomask_and_B_allones_splat( -; CHECK-NEXT: [[TST1:%.*]] = icmp slt <2 x i32> [[A:%.*]], -; CHECK-NEXT: [[MASK2:%.*]] = and <2 x i32> [[A]], -; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i32> [[MASK2]], -; CHECK-NEXT: [[RES:%.*]] = and <2 x i1> [[TST1]], [[TST2]] +; CHECK-LABEL: @nomask_splat_and_B_allones( +; CHECK-NEXT: [[RES:%.*]] = icmp ugt <2 x i32> [[A:%.*]], ; CHECK-NEXT: ret <2 x i1> [[RES]] ; %tst1 = icmp slt <2 x i32> %A, @@ -393,11 +390,9 @@ } define <2 x i1> @nomask_splat_and_B_mixed(<2 x i32> %A) { -; CHECK-LABEL: @nomask_and_B_mixed_splat( -; CHECK-NEXT: [[TST1:%.*]] = icmp sgt <2 x i32> [[A:%.*]], -; CHECK-NEXT: [[MASK2:%.*]] = and <2 x i32> [[A]], -; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i32> [[MASK2]], -; CHECK-NEXT: [[RES:%.*]] = and <2 x i1> [[TST1]], [[TST2]] +; CHECK-LABEL: @nomask_splat_and_B_mixed( +; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[A:%.*]], +; CHECK-NEXT: [[RES:%.*]] = icmp eq <2 x i32> [[TMP1]], ; CHECK-NEXT: ret <2 x i1> [[RES]] ; %tst1 = icmp sgt <2 x i32> %A, diff --git a/llvm/test/Transforms/InstCombine/signed-truncation-check.ll b/llvm/test/Transforms/InstCombine/signed-truncation-check.ll --- a/llvm/test/Transforms/InstCombine/signed-truncation-check.ll +++ b/llvm/test/Transforms/InstCombine/signed-truncation-check.ll @@ -200,11 +200,8 @@ define <3 x i1> @positive_vec_undef0(<3 x i32> %arg) { ; CHECK-LABEL: @positive_vec_undef0( -; CHECK-NEXT: [[T1:%.*]] = icmp sgt <3 x i32> [[ARG:%.*]], -; CHECK-NEXT: [[T2:%.*]] = add <3 x i32> [[ARG]], -; CHECK-NEXT: [[T3:%.*]] = icmp ult <3 x i32> [[T2]], -; CHECK-NEXT: [[T4:%.*]] = and <3 x i1> [[T1]], [[T3]] -; CHECK-NEXT: ret <3 x i1> [[T4]] +; CHECK-NEXT: [[T4_SIMPLIFIED:%.*]] = icmp ult <3 x i32> [[ARG:%.*]], +; CHECK-NEXT: ret <3 x i1> [[T4_SIMPLIFIED]] ; %t1 = icmp sgt <3 x i32> %arg, %t2 = add <3 x i32> %arg,