[InstSimplify] add folds for or-of-icmps with same operands

All of these (and a few more) are already handled by InstCombine,
but we shouldn't have to wait until then to simplify these because
they're cheap to deal with here in InstSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288833 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2016-12-06 18:09:37 +00:00
parent 1f9118e823
commit b4824c6afa
2 changed files with 93 additions and 200 deletions

View File

@ -1700,12 +1700,44 @@ Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const DataLayout &DL,
RecursionLimit);
}
/// Simplify (or (icmp ...) (icmp ...)) to true when we can tell that the union
/// contains all possible values.
/// Commuted variants are assumed to be handled by calling this function again
/// with the parameters swapped.
static Value *simplifyOrOfICmpsWithSameOperands(ICmpInst *Op0, ICmpInst *Op1) {
ICmpInst::Predicate Pred0, Pred1;
Value *A ,*B;
match(Op0, m_ICmp(Pred0, m_Value(A), m_Value(B)));
if (match(Op1, m_ICmp(Pred1, m_Specific(B), m_Specific(A))))
Op1->swapOperands();
if (!match(Op1, m_ICmp(Pred1, m_Specific(A), m_Specific(B))))
return nullptr;
// We have (icmp Pred0, A, B) | (icmp Pred1, A, B).
// If Op1 is always implied true by Op0, then Op0 is a subset of Op1, and we
// can eliminate Op0 from this 'or'.
if (ICmpInst::isImpliedTrueByMatchingCmp(Pred0, Pred1))
return Op1;
// Check for any combination of predicates that cover the entire range of
// possibilities.
if ((Pred0 == ICmpInst::getInversePredicate(Pred1)) ||
(Pred0 == ICmpInst::ICMP_NE && ICmpInst::isTrueWhenEqual(Pred1)) ||
(Pred0 == ICmpInst::ICMP_SLE && Pred1 == ICmpInst::ICMP_SGE) ||
(Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_UGE))
return getTrue(Op0->getType());
return nullptr;
}
/// Commuted variants are assumed to be handled by calling this function again
/// with the parameters swapped.
static Value *SimplifyOrOfICmps(ICmpInst *Op0, ICmpInst *Op1) {
if (Value *X = simplifyUnsignedRangeCheck(Op0, Op1, /*IsAnd=*/false))
return X;
if (Value *X = simplifyOrOfICmpsWithSameOperands(Op0, Op1))
return X;
// (icmp (add V, C0), C1) | (icmp V, C0)
ICmpInst::Predicate Pred0, Pred1;
const APInt *C0, *C1;

View File

@ -2,14 +2,12 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
; There are 10 * 10 combinations of icmp predicates that can be OR'd together.
; FIXME: The majority of these can be simplified to always true or just one of the icmps.
; The majority of these can be simplified to always true or just one of the icmps.
define i1 @eq_eq(i8 %a, i8 %b) {
; CHECK-LABEL: @eq_eq(
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp eq i8 %a, %b
%cmp2 = icmp eq i8 %a, %b
@ -19,10 +17,7 @@ define i1 @eq_eq(i8 %a, i8 %b) {
define i1 @eq_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @eq_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp eq i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -32,10 +27,8 @@ define i1 @eq_ne(i8 %a, i8 %b) {
define i1 @eq_sge(i8 %a, i8 %b) {
; CHECK-LABEL: @eq_sge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp eq i8 %a, %b
%cmp2 = icmp sge i8 %a, %b
@ -58,10 +51,8 @@ define i1 @eq_sgt(i8 %a, i8 %b) {
define i1 @eq_sle(i8 %a, i8 %b) {
; CHECK-LABEL: @eq_sle(
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp eq i8 %a, %b
%cmp2 = icmp sle i8 %a, %b
@ -84,10 +75,8 @@ define i1 @eq_slt(i8 %a, i8 %b) {
define i1 @eq_uge(i8 %a, i8 %b) {
; CHECK-LABEL: @eq_uge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp eq i8 %a, %b
%cmp2 = icmp uge i8 %a, %b
@ -110,10 +99,8 @@ define i1 @eq_ugt(i8 %a, i8 %b) {
define i1 @eq_ule(i8 %a, i8 %b) {
; CHECK-LABEL: @eq_ule(
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp eq i8 %a, %b
%cmp2 = icmp ule i8 %a, %b
@ -138,10 +125,7 @@ define i1 @eq_ult(i8 %a, i8 %b) {
define i1 @ne_eq(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_eq(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp eq i8 %a, %b
@ -151,10 +135,8 @@ define i1 @ne_eq(i8 %a, i8 %b) {
define i1 @ne_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -164,10 +146,7 @@ define i1 @ne_ne(i8 %a, i8 %b) {
define i1 @ne_sge(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_sge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp sge i8 %a, %b
@ -178,9 +157,7 @@ define i1 @ne_sge(i8 %a, i8 %b) {
define i1 @ne_sgt(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_sgt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp sgt i8 %a, %b
@ -190,10 +167,7 @@ define i1 @ne_sgt(i8 %a, i8 %b) {
define i1 @ne_sle(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_sle(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp sle i8 %a, %b
@ -204,9 +178,7 @@ define i1 @ne_sle(i8 %a, i8 %b) {
define i1 @ne_slt(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_slt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp slt i8 %a, %b
@ -216,10 +188,7 @@ define i1 @ne_slt(i8 %a, i8 %b) {
define i1 @ne_uge(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_uge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp uge i8 %a, %b
@ -230,9 +199,7 @@ define i1 @ne_uge(i8 %a, i8 %b) {
define i1 @ne_ugt(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_ugt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp ugt i8 %a, %b
@ -242,10 +209,7 @@ define i1 @ne_ugt(i8 %a, i8 %b) {
define i1 @ne_ule(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_ule(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp ule i8 %a, %b
@ -256,9 +220,7 @@ define i1 @ne_ule(i8 %a, i8 %b) {
define i1 @ne_ult(i8 %a, i8 %b) {
; CHECK-LABEL: @ne_ult(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp ne i8 %a, %b
%cmp2 = icmp ult i8 %a, %b
@ -271,9 +233,7 @@ define i1 @ne_ult(i8 %a, i8 %b) {
define i1 @sge_eq(i8 %a, i8 %b) {
; CHECK-LABEL: @sge_eq(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp sge i8 %a, %b
%cmp2 = icmp eq i8 %a, %b
@ -283,10 +243,7 @@ define i1 @sge_eq(i8 %a, i8 %b) {
define i1 @sge_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @sge_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sge i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -296,10 +253,8 @@ define i1 @sge_ne(i8 %a, i8 %b) {
define i1 @sge_sge(i8 %a, i8 %b) {
; CHECK-LABEL: @sge_sge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp sge i8 %a, %b
%cmp2 = icmp sge i8 %a, %b
@ -310,9 +265,7 @@ define i1 @sge_sge(i8 %a, i8 %b) {
define i1 @sge_sgt(i8 %a, i8 %b) {
; CHECK-LABEL: @sge_sgt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp sge i8 %a, %b
%cmp2 = icmp sgt i8 %a, %b
@ -322,10 +275,7 @@ define i1 @sge_sgt(i8 %a, i8 %b) {
define i1 @sge_sle(i8 %a, i8 %b) {
; CHECK-LABEL: @sge_sle(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sge i8 %a, %b
%cmp2 = icmp sle i8 %a, %b
@ -335,10 +285,7 @@ define i1 @sge_sle(i8 %a, i8 %b) {
define i1 @sge_slt(i8 %a, i8 %b) {
; CHECK-LABEL: @sge_slt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sge i8 %a, %b
%cmp2 = icmp slt i8 %a, %b
@ -415,10 +362,8 @@ define i1 @sgt_eq(i8 %a, i8 %b) {
define i1 @sgt_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @sgt_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp sgt i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -428,10 +373,8 @@ define i1 @sgt_ne(i8 %a, i8 %b) {
define i1 @sgt_sge(i8 %a, i8 %b) {
; CHECK-LABEL: @sgt_sge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp sgt i8 %a, %b
%cmp2 = icmp sge i8 %a, %b
@ -441,10 +384,8 @@ define i1 @sgt_sge(i8 %a, i8 %b) {
define i1 @sgt_sgt(i8 %a, i8 %b) {
; CHECK-LABEL: @sgt_sgt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp sgt i8 %a, %b
%cmp2 = icmp sgt i8 %a, %b
@ -454,10 +395,7 @@ define i1 @sgt_sgt(i8 %a, i8 %b) {
define i1 @sgt_sle(i8 %a, i8 %b) {
; CHECK-LABEL: @sgt_sle(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sgt i8 %a, %b
%cmp2 = icmp sle i8 %a, %b
@ -535,9 +473,7 @@ define i1 @sgt_ult(i8 %a, i8 %b) {
define i1 @sle_eq(i8 %a, i8 %b) {
; CHECK-LABEL: @sle_eq(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp sle i8 %a, %b
%cmp2 = icmp eq i8 %a, %b
@ -547,10 +483,7 @@ define i1 @sle_eq(i8 %a, i8 %b) {
define i1 @sle_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @sle_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sle i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -560,10 +493,7 @@ define i1 @sle_ne(i8 %a, i8 %b) {
define i1 @sle_sge(i8 %a, i8 %b) {
; CHECK-LABEL: @sle_sge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sle i8 %a, %b
%cmp2 = icmp sge i8 %a, %b
@ -573,10 +503,7 @@ define i1 @sle_sge(i8 %a, i8 %b) {
define i1 @sle_sgt(i8 %a, i8 %b) {
; CHECK-LABEL: @sle_sgt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp sle i8 %a, %b
%cmp2 = icmp sgt i8 %a, %b
@ -586,10 +513,8 @@ define i1 @sle_sgt(i8 %a, i8 %b) {
define i1 @sle_sle(i8 %a, i8 %b) {
; CHECK-LABEL: @sle_sle(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp sle i8 %a, %b
%cmp2 = icmp sle i8 %a, %b
@ -600,9 +525,7 @@ define i1 @sle_sle(i8 %a, i8 %b) {
define i1 @sle_slt(i8 %a, i8 %b) {
; CHECK-LABEL: @sle_slt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp sle i8 %a, %b
%cmp2 = icmp slt i8 %a, %b
@ -679,10 +602,8 @@ define i1 @slt_eq(i8 %a, i8 %b) {
define i1 @slt_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @slt_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp slt i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -692,10 +613,7 @@ define i1 @slt_ne(i8 %a, i8 %b) {
define i1 @slt_sge(i8 %a, i8 %b) {
; CHECK-LABEL: @slt_sge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp slt i8 %a, %b
%cmp2 = icmp sge i8 %a, %b
@ -718,10 +636,8 @@ define i1 @slt_sgt(i8 %a, i8 %b) {
define i1 @slt_sle(i8 %a, i8 %b) {
; CHECK-LABEL: @slt_sle(
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp slt i8 %a, %b
%cmp2 = icmp sle i8 %a, %b
@ -731,10 +647,8 @@ define i1 @slt_sle(i8 %a, i8 %b) {
define i1 @slt_slt(i8 %a, i8 %b) {
; CHECK-LABEL: @slt_slt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp slt i8 %a, %b
%cmp2 = icmp slt i8 %a, %b
@ -799,9 +713,7 @@ define i1 @slt_ult(i8 %a, i8 %b) {
define i1 @uge_eq(i8 %a, i8 %b) {
; CHECK-LABEL: @uge_eq(
; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp uge i8 %a, %b
%cmp2 = icmp eq i8 %a, %b
@ -811,10 +723,7 @@ define i1 @uge_eq(i8 %a, i8 %b) {
define i1 @uge_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @uge_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp uge i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -876,10 +785,8 @@ define i1 @uge_slt(i8 %a, i8 %b) {
define i1 @uge_uge(i8 %a, i8 %b) {
; CHECK-LABEL: @uge_uge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp uge i8 %a, %b
%cmp2 = icmp uge i8 %a, %b
@ -890,9 +797,7 @@ define i1 @uge_uge(i8 %a, i8 %b) {
define i1 @uge_ugt(i8 %a, i8 %b) {
; CHECK-LABEL: @uge_ugt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp uge i8 %a, %b
%cmp2 = icmp ugt i8 %a, %b
@ -902,10 +807,7 @@ define i1 @uge_ugt(i8 %a, i8 %b) {
define i1 @uge_ule(i8 %a, i8 %b) {
; CHECK-LABEL: @uge_ule(
; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp uge i8 %a, %b
%cmp2 = icmp ule i8 %a, %b
@ -915,10 +817,7 @@ define i1 @uge_ule(i8 %a, i8 %b) {
define i1 @uge_ult(i8 %a, i8 %b) {
; CHECK-LABEL: @uge_ult(
; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp uge i8 %a, %b
%cmp2 = icmp ult i8 %a, %b
@ -943,10 +842,8 @@ define i1 @ugt_eq(i8 %a, i8 %b) {
define i1 @ugt_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @ugt_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ugt i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -1008,10 +905,8 @@ define i1 @ugt_slt(i8 %a, i8 %b) {
define i1 @ugt_uge(i8 %a, i8 %b) {
; CHECK-LABEL: @ugt_uge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ugt i8 %a, %b
%cmp2 = icmp uge i8 %a, %b
@ -1021,10 +916,8 @@ define i1 @ugt_uge(i8 %a, i8 %b) {
define i1 @ugt_ugt(i8 %a, i8 %b) {
; CHECK-LABEL: @ugt_ugt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ugt i8 %a, %b
%cmp2 = icmp ugt i8 %a, %b
@ -1034,10 +927,7 @@ define i1 @ugt_ugt(i8 %a, i8 %b) {
define i1 @ugt_ule(i8 %a, i8 %b) {
; CHECK-LABEL: @ugt_ule(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ugt i8 %a, %b
%cmp2 = icmp ule i8 %a, %b
@ -1063,9 +953,7 @@ define i1 @ugt_ult(i8 %a, i8 %b) {
define i1 @ule_eq(i8 %a, i8 %b) {
; CHECK-LABEL: @ule_eq(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp ule i8 %a, %b
%cmp2 = icmp eq i8 %a, %b
@ -1075,10 +963,7 @@ define i1 @ule_eq(i8 %a, i8 %b) {
define i1 @ule_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @ule_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ule i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -1140,10 +1025,7 @@ define i1 @ule_slt(i8 %a, i8 %b) {
define i1 @ule_uge(i8 %a, i8 %b) {
; CHECK-LABEL: @ule_uge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ule i8 %a, %b
%cmp2 = icmp uge i8 %a, %b
@ -1153,10 +1035,7 @@ define i1 @ule_uge(i8 %a, i8 %b) {
define i1 @ule_ugt(i8 %a, i8 %b) {
; CHECK-LABEL: @ule_ugt(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ule i8 %a, %b
%cmp2 = icmp ugt i8 %a, %b
@ -1166,10 +1045,8 @@ define i1 @ule_ugt(i8 %a, i8 %b) {
define i1 @ule_ule(i8 %a, i8 %b) {
; CHECK-LABEL: @ule_ule(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ule i8 %a, %b
%cmp2 = icmp ule i8 %a, %b
@ -1180,9 +1057,7 @@ define i1 @ule_ule(i8 %a, i8 %b) {
define i1 @ule_ult(i8 %a, i8 %b) {
; CHECK-LABEL: @ule_ult(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp1 = icmp ule i8 %a, %b
%cmp2 = icmp ult i8 %a, %b
@ -1207,10 +1082,8 @@ define i1 @ult_eq(i8 %a, i8 %b) {
define i1 @ult_ne(i8 %a, i8 %b) {
; CHECK-LABEL: @ult_ne(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ult i8 %a, %b
%cmp2 = icmp ne i8 %a, %b
@ -1272,10 +1145,7 @@ define i1 @ult_slt(i8 %a, i8 %b) {
define i1 @ult_uge(i8 %a, i8 %b) {
; CHECK-LABEL: @ult_uge(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 true
;
%cmp1 = icmp ult i8 %a, %b
%cmp2 = icmp uge i8 %a, %b
@ -1298,10 +1168,8 @@ define i1 @ult_ugt(i8 %a, i8 %b) {
define i1 @ult_ule(i8 %a, i8 %b) {
; CHECK-LABEL: @ult_ule(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ult i8 %a, %b
%cmp2 = icmp ule i8 %a, %b
@ -1311,10 +1179,8 @@ define i1 @ult_ule(i8 %a, i8 %b) {
define i1 @ult_ult(i8 %a, i8 %b) {
; CHECK-LABEL: @ult_ult(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret i1 [[OR]]
; CHECK-NEXT: ret i1 [[CMP2]]
;
%cmp1 = icmp ult i8 %a, %b
%cmp2 = icmp ult i8 %a, %b
@ -1326,10 +1192,7 @@ define i1 @ult_ult(i8 %a, i8 %b) {
define <2 x i1> @ult_uge_vec(<2 x i8> %a, <2 x i8> %b) {
; CHECK-LABEL: @ult_uge_vec(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult <2 x i8> %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge <2 x i8> %a, %b
; CHECK-NEXT: [[OR:%.*]] = or <2 x i1> [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret <2 x i1> [[OR]]
; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
;
%cmp1 = icmp ult <2 x i8> %a, %b
%cmp2 = icmp uge <2 x i8> %a, %b
@ -1339,10 +1202,8 @@ define <2 x i1> @ult_uge_vec(<2 x i8> %a, <2 x i8> %b) {
define <2 x i1> @ult_ule_vec(<2 x i8> %a, <2 x i8> %b) {
; CHECK-LABEL: @ult_ule_vec(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult <2 x i8> %a, %b
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule <2 x i8> %a, %b
; CHECK-NEXT: [[OR:%.*]] = or <2 x i1> [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret <2 x i1> [[OR]]
; CHECK-NEXT: ret <2 x i1> [[CMP2]]
;
%cmp1 = icmp ult <2 x i8> %a, %b
%cmp2 = icmp ule <2 x i8> %a, %b