This change would add functionality if isImpliedCondition worked on
vector types; but since it bail out on vector predicates this change is
an NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252672
91177308-0d34-0410-b5e6-
96231b3b80d8
const DataLayout &DL, unsigned Depth,
AssumptionCache *AC, const Instruction *CxtI,
const DominatorTree *DT) {
const DataLayout &DL, unsigned Depth,
AssumptionCache *AC, const Instruction *CxtI,
const DominatorTree *DT) {
+ assert(!LHS->getType()->isVectorTy() && "TODO: extend to handle vectors!");
if (ICmpInst::isTrueWhenEqual(Pred) && LHS == RHS)
return true;
if (ICmpInst::isTrueWhenEqual(Pred) && LHS == RHS)
return true;
case CmpInst::ICMP_SLT:
case CmpInst::ICMP_SLE: {
case CmpInst::ICMP_SLT:
case CmpInst::ICMP_SLE: {
// LHS s< LHS +_{nsw} C if C > 0
// LHS s<= LHS +_{nsw} C if C >= 0
// LHS s< LHS +_{nsw} C if C > 0
// LHS s<= LHS +_{nsw} C if C >= 0
- if (match(RHS, m_NSWAdd(m_Specific(LHS), m_ConstantInt(CI)))) {
+ if (match(RHS, m_NSWAdd(m_Specific(LHS), m_APInt(C)))) {
if (Pred == CmpInst::ICMP_SLT)
if (Pred == CmpInst::ICMP_SLT)
- return CI->getValue().isStrictlyPositive();
- return !CI->isNegative();
+ return C->isStrictlyPositive();
+ return !C->isNegative();
}
return false;
}
case CmpInst::ICMP_ULT:
case CmpInst::ICMP_ULE: {
}
return false;
}
case CmpInst::ICMP_ULT:
case CmpInst::ICMP_ULE: {
// LHS u< LHS +_{nuw} C if C != 0
// LHS u<= LHS +_{nuw} C
// LHS u< LHS +_{nuw} C if C != 0
// LHS u<= LHS +_{nuw} C
- if (match(RHS, m_NUWAdd(m_Specific(LHS), m_ConstantInt(CI)))) {
+ if (match(RHS, m_NUWAdd(m_Specific(LHS), m_APInt(C)))) {
if (Pred == CmpInst::ICMP_ULT)
if (Pred == CmpInst::ICMP_ULT)
+ return C->isMinValue();
return true;
}
return false;
return true;
}
return false;