[llvm] r252672 - [ValueTracking] Use m_APInt instead of m_ConstantInt, NFC
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 15:56:16 PST 2015
Author: sanjoy
Date: Tue Nov 10 17:56:15 2015
New Revision: 252672
URL: http://llvm.org/viewvc/llvm-project?rev=252672&view=rev
Log:
[ValueTracking] Use m_APInt instead of m_ConstantInt, NFC
This change would add functionality if isImpliedCondition worked on
vector types; but since it bail out on vector predicates this change is
an NFC.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=252672&r1=252671&r2=252672&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Nov 10 17:56:15 2015
@@ -4103,6 +4103,7 @@ static bool isTruePredicate(CmpInst::Pre
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;
@@ -4112,27 +4113,27 @@ static bool isTruePredicate(CmpInst::Pre
case CmpInst::ICMP_SLT:
case CmpInst::ICMP_SLE: {
- ConstantInt *CI;
+ const APInt *C;
// 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)
- return CI->getValue().isStrictlyPositive();
- return !CI->isNegative();
+ return C->isStrictlyPositive();
+ return !C->isNegative();
}
return false;
}
case CmpInst::ICMP_ULT:
case CmpInst::ICMP_ULE: {
- ConstantInt *CI;
+ const APInt *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)
- return !CI->isZero();
+ return C->isMinValue();
return true;
}
return false;
More information about the llvm-commits
mailing list