mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -617,7 +617,7 @@ SCEVHandle SCEVAddExpr::get(std::vector<SCEVHandle> &Ops) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we are left with a constant zero being added, strip it off.
|
// If we are left with a constant zero being added, strip it off.
|
||||||
if (cast<SCEVConstant>(Ops[0])->getValue()->isNullValue()) {
|
if (cast<SCEVConstant>(Ops[0])->getValue()->isZero()) {
|
||||||
Ops.erase(Ops.begin());
|
Ops.erase(Ops.begin());
|
||||||
--Idx;
|
--Idx;
|
||||||
}
|
}
|
||||||
@@ -857,7 +857,7 @@ SCEVHandle SCEVMulExpr::get(std::vector<SCEVHandle> &Ops) {
|
|||||||
if (cast<SCEVConstant>(Ops[0])->getValue()->equalsInt(1)) {
|
if (cast<SCEVConstant>(Ops[0])->getValue()->equalsInt(1)) {
|
||||||
Ops.erase(Ops.begin());
|
Ops.erase(Ops.begin());
|
||||||
--Idx;
|
--Idx;
|
||||||
} else if (cast<SCEVConstant>(Ops[0])->getValue()->isNullValue()) {
|
} else if (cast<SCEVConstant>(Ops[0])->getValue()->isZero()) {
|
||||||
// If we have a multiply of zero, it will always be zero.
|
// If we have a multiply of zero, it will always be zero.
|
||||||
return Ops[0];
|
return Ops[0];
|
||||||
}
|
}
|
||||||
@@ -1026,7 +1026,7 @@ SCEVHandle SCEVAddRecExpr::get(std::vector<SCEVHandle> &Operands,
|
|||||||
if (Operands.size() == 1) return Operands[0];
|
if (Operands.size() == 1) return Operands[0];
|
||||||
|
|
||||||
if (SCEVConstant *StepC = dyn_cast<SCEVConstant>(Operands.back()))
|
if (SCEVConstant *StepC = dyn_cast<SCEVConstant>(Operands.back()))
|
||||||
if (StepC->getValue()->isNullValue()) {
|
if (StepC->getValue()->isZero()) {
|
||||||
Operands.pop_back();
|
Operands.pop_back();
|
||||||
return get(Operands, L); // { X,+,0 } --> X
|
return get(Operands, L); // { X,+,0 } --> X
|
||||||
}
|
}
|
||||||
@@ -2124,7 +2124,7 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
|
|||||||
// If the value is a constant
|
// If the value is a constant
|
||||||
if (SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
|
if (SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
|
||||||
// If the value is already zero, the branch will execute zero times.
|
// If the value is already zero, the branch will execute zero times.
|
||||||
if (C->getValue()->isNullValue()) return C;
|
if (C->getValue()->isZero()) return C;
|
||||||
return UnknownValue; // Otherwise it will loop infinitely.
|
return UnknownValue; // Otherwise it will loop infinitely.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2187,7 +2187,7 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
|
|||||||
// should not accept a root of 2.
|
// should not accept a root of 2.
|
||||||
SCEVHandle Val = AddRec->evaluateAtIteration(R1);
|
SCEVHandle Val = AddRec->evaluateAtIteration(R1);
|
||||||
if (SCEVConstant *EvalVal = dyn_cast<SCEVConstant>(Val))
|
if (SCEVConstant *EvalVal = dyn_cast<SCEVConstant>(Val))
|
||||||
if (EvalVal->getValue()->isNullValue())
|
if (EvalVal->getValue()->isZero())
|
||||||
return R1; // We found a quadratic root!
|
return R1; // We found a quadratic root!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2327,7 +2327,7 @@ SCEVHandle SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
|
|||||||
|
|
||||||
// If the start is a non-zero constant, shift the range to simplify things.
|
// If the start is a non-zero constant, shift the range to simplify things.
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(getStart()))
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(getStart()))
|
||||||
if (!SC->getValue()->isNullValue()) {
|
if (!SC->getValue()->isZero()) {
|
||||||
std::vector<SCEVHandle> Operands(op_begin(), op_end());
|
std::vector<SCEVHandle> Operands(op_begin(), op_end());
|
||||||
Operands[0] = SCEVUnknown::getIntegerSCEV(0, SC->getType());
|
Operands[0] = SCEVUnknown::getIntegerSCEV(0, SC->getType());
|
||||||
SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop());
|
SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop());
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
|
|||||||
|
|
||||||
// {X,+,F} --> X + {0,+,F}
|
// {X,+,F} --> X + {0,+,F}
|
||||||
if (!isa<SCEVConstant>(S->getStart()) ||
|
if (!isa<SCEVConstant>(S->getStart()) ||
|
||||||
!cast<SCEVConstant>(S->getStart())->getValue()->isNullValue()) {
|
!cast<SCEVConstant>(S->getStart())->getValue()->isZero()) {
|
||||||
Value *Start = expandInTy(S->getStart(), Ty);
|
Value *Start = expandInTy(S->getStart(), Ty);
|
||||||
std::vector<SCEVHandle> NewOps(S->op_begin(), S->op_end());
|
std::vector<SCEVHandle> NewOps(S->op_begin(), S->op_end());
|
||||||
NewOps[0] = SCEVUnknown::getIntegerSCEV(0, Ty);
|
NewOps[0] = SCEVUnknown::getIntegerSCEV(0, Ty);
|
||||||
|
|||||||
@@ -1155,7 +1155,7 @@ static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
|
|||||||
// instead of a select to synthesize the desired value.
|
// instead of a select to synthesize the desired value.
|
||||||
bool IsOneZero = false;
|
bool IsOneZero = false;
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal))
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal))
|
||||||
IsOneZero = InitVal->isNullValue() && CI->equalsInt(1);
|
IsOneZero = InitVal->isNullValue() && CI->isOne();
|
||||||
|
|
||||||
while (!GV->use_empty()) {
|
while (!GV->use_empty()) {
|
||||||
Instruction *UI = cast<Instruction>(GV->use_back());
|
Instruction *UI = cast<Instruction>(GV->use_back());
|
||||||
|
|||||||
@@ -584,7 +584,7 @@ public:
|
|||||||
for (uint64_t i = 0; i < len; ++i) {
|
for (uint64_t i = 0; i < len; ++i) {
|
||||||
if (ConstantInt* CI = dyn_cast<ConstantInt>(CA->getOperand(i))) {
|
if (ConstantInt* CI = dyn_cast<ConstantInt>(CA->getOperand(i))) {
|
||||||
// Check for the null terminator
|
// Check for the null terminator
|
||||||
if (CI->isNullValue())
|
if (CI->isZero())
|
||||||
break; // we found end of string
|
break; // we found end of string
|
||||||
else if (CI->getSExtValue() == chr) {
|
else if (CI->getSExtValue() == chr) {
|
||||||
char_found = true;
|
char_found = true;
|
||||||
@@ -2023,7 +2023,7 @@ static bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA)
|
|||||||
// Check to make sure that the first operand of the GEP is an integer and
|
// Check to make sure that the first operand of the GEP is an integer and
|
||||||
// has value 0 so that we are sure we're indexing into the initializer.
|
// has value 0 so that we are sure we're indexing into the initializer.
|
||||||
if (ConstantInt* op1 = dyn_cast<ConstantInt>(GEP->getOperand(1))) {
|
if (ConstantInt* op1 = dyn_cast<ConstantInt>(GEP->getOperand(1))) {
|
||||||
if (!op1->isNullValue())
|
if (!op1->isZero())
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@@ -2069,7 +2069,7 @@ static bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA)
|
|||||||
for (len = start_idx; len < max_elems; len++) {
|
for (len = start_idx; len < max_elems; len++) {
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(A->getOperand(len))) {
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(A->getOperand(len))) {
|
||||||
// Check for the null terminator
|
// Check for the null terminator
|
||||||
if (CI->isNullValue())
|
if (CI->isZero())
|
||||||
break; // we found end of string
|
break; // we found end of string
|
||||||
} else
|
} else
|
||||||
return false; // This array isn't suitable, non-int initializer
|
return false; // This array isn't suitable, non-int initializer
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ void CondProp::SimplifyPredecessors(BranchInst *BI) {
|
|||||||
// ultimate destination.
|
// ultimate destination.
|
||||||
bool PHIGone = PN->getNumIncomingValues() == 2;
|
bool PHIGone = PN->getNumIncomingValues() == 2;
|
||||||
RevectorBlockTo(PN->getIncomingBlock(i-1),
|
RevectorBlockTo(PN->getIncomingBlock(i-1),
|
||||||
BI->getSuccessor(CB->isNullValue()));
|
BI->getSuccessor(CB->isZero()));
|
||||||
++NumBrThread;
|
++NumBrThread;
|
||||||
|
|
||||||
// If there were two predecessors before this simplification, the PHI node
|
// If there were two predecessors before this simplification, the PHI node
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
|
|||||||
Constant *NCE = ConstantExpr::getGetElementPtr(CE->getOperand(0),
|
Constant *NCE = ConstantExpr::getGetElementPtr(CE->getOperand(0),
|
||||||
&CEIdxs[0],
|
&CEIdxs[0],
|
||||||
CEIdxs.size());
|
CEIdxs.size());
|
||||||
GetElementPtrInst *NGEPI =
|
GetElementPtrInst *NGEPI = new GetElementPtrInst(
|
||||||
new GetElementPtrInst(NCE, Constant::getNullValue(Type::Int32Ty),
|
NCE, Constant::getNullValue(Type::Int32Ty), NewAdd,
|
||||||
NewAdd, GEPI->getName(), GEPI);
|
GEPI->getName(), GEPI);
|
||||||
GEPI->replaceAllUsesWith(NGEPI);
|
GEPI->replaceAllUsesWith(NGEPI);
|
||||||
GEPI->eraseFromParent();
|
GEPI->eraseFromParent();
|
||||||
GEPI = NGEPI;
|
GEPI = NGEPI;
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase,
|
|||||||
|
|
||||||
// If there is no immediate value, skip the next part.
|
// If there is no immediate value, skip the next part.
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Imm))
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Imm))
|
||||||
if (SC->getValue()->isNullValue())
|
if (SC->getValue()->isZero())
|
||||||
return Rewriter.expandCodeFor(NewBase, BaseInsertPt,
|
return Rewriter.expandCodeFor(NewBase, BaseInsertPt,
|
||||||
OperandValToReplace->getType());
|
OperandValToReplace->getType());
|
||||||
|
|
||||||
@@ -779,7 +779,7 @@ static void SeparateSubExprs(std::vector<SCEVHandle> &SubExprs,
|
|||||||
SeparateSubExprs(SubExprs, SARE->getOperand(0));
|
SeparateSubExprs(SubExprs, SARE->getOperand(0));
|
||||||
}
|
}
|
||||||
} else if (!isa<SCEVConstant>(Expr) ||
|
} else if (!isa<SCEVConstant>(Expr) ||
|
||||||
!cast<SCEVConstant>(Expr)->getValue()->isNullValue()) {
|
!cast<SCEVConstant>(Expr)->getValue()->isZero()) {
|
||||||
// Do not add zero.
|
// Do not add zero.
|
||||||
SubExprs.push_back(Expr);
|
SubExprs.push_back(Expr);
|
||||||
}
|
}
|
||||||
@@ -869,7 +869,7 @@ RemoveCommonExpressionsFromUseBases(std::vector<BasedUser> &Uses) {
|
|||||||
///
|
///
|
||||||
static bool isZero(SCEVHandle &V) {
|
static bool isZero(SCEVHandle &V) {
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V))
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V))
|
||||||
return SC->getValue()->getZExtValue() == 0;
|
return SC->getValue()->isZero();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -883,17 +883,18 @@ unsigned LoopStrengthReduce::CheckForIVReuse(const SCEVHandle &Stride,
|
|||||||
if (!TLI) return 0;
|
if (!TLI) return 0;
|
||||||
|
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride)) {
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride)) {
|
||||||
int64_t SInt = SC->getValue()->getSExtValue();
|
const APInt &SInt = SC->getValue()->getValue();
|
||||||
if (SInt == 1) return 0;
|
if (SInt == 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (TargetLowering::legal_am_scale_iterator
|
for (TargetLowering::legal_am_scale_iterator
|
||||||
I = TLI->legal_am_scale_begin(), E = TLI->legal_am_scale_end();
|
I = TLI->legal_am_scale_begin(), E = TLI->legal_am_scale_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
unsigned Scale = *I;
|
APInt Scale(SInt.getBitWidth(), *I);
|
||||||
if (unsigned(abs(SInt)) < Scale || (SInt % Scale) != 0)
|
if (SInt.abs().ult(Scale) || SInt.srem(Scale) != 0)
|
||||||
continue;
|
continue;
|
||||||
std::map<SCEVHandle, IVsOfOneStride>::iterator SI =
|
std::map<SCEVHandle, IVsOfOneStride>::iterator SI =
|
||||||
IVsByStride.find(SCEVUnknown::getIntegerSCEV(SInt/Scale, UIntPtrTy));
|
IVsByStride.find(SCEVUnknown::getIntegerSCEV(SInt.sdiv(Scale)));
|
||||||
if (SI == IVsByStride.end())
|
if (SI == IVsByStride.end())
|
||||||
continue;
|
continue;
|
||||||
for (std::vector<IVExpr>::iterator II = SI->second.IVs.begin(),
|
for (std::vector<IVExpr>::iterator II = SI->second.IVs.begin(),
|
||||||
@@ -902,7 +903,7 @@ unsigned LoopStrengthReduce::CheckForIVReuse(const SCEVHandle &Stride,
|
|||||||
// Only reuse previous IV if it would not require a type conversion.
|
// Only reuse previous IV if it would not require a type conversion.
|
||||||
if (isZero(II->Base) && II->Base->getType() == Ty) {
|
if (isZero(II->Base) && II->Base->getType() == Ty) {
|
||||||
IV = *II;
|
IV = *II;
|
||||||
return Scale;
|
return Scale.getZExtValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1148,14 +1149,14 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
|
|||||||
// are reusing an IV, it has not been used to initialize the PHI node.
|
// are reusing an IV, it has not been used to initialize the PHI node.
|
||||||
// Add it to the expression used to rewrite the uses.
|
// Add it to the expression used to rewrite the uses.
|
||||||
if (!isa<ConstantInt>(CommonBaseV) ||
|
if (!isa<ConstantInt>(CommonBaseV) ||
|
||||||
!cast<ConstantInt>(CommonBaseV)->isNullValue())
|
!cast<ConstantInt>(CommonBaseV)->isZero())
|
||||||
RewriteExpr = SCEVAddExpr::get(RewriteExpr,
|
RewriteExpr = SCEVAddExpr::get(RewriteExpr,
|
||||||
SCEVUnknown::get(CommonBaseV));
|
SCEVUnknown::get(CommonBaseV));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we know what we need to do, insert code before User for the
|
// Now that we know what we need to do, insert code before User for the
|
||||||
// immediate and any loop-variant expressions.
|
// immediate and any loop-variant expressions.
|
||||||
if (!isa<ConstantInt>(BaseV) || !cast<ConstantInt>(BaseV)->isNullValue())
|
if (!isa<ConstantInt>(BaseV) || !cast<ConstantInt>(BaseV)->isZero())
|
||||||
// Add BaseV to the PHI value if needed.
|
// Add BaseV to the PHI value if needed.
|
||||||
RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV));
|
RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV));
|
||||||
|
|
||||||
@@ -1257,14 +1258,17 @@ namespace {
|
|||||||
SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS);
|
SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS);
|
||||||
SCEVConstant *RHSC = dyn_cast<SCEVConstant>(RHS);
|
SCEVConstant *RHSC = dyn_cast<SCEVConstant>(RHS);
|
||||||
if (LHSC && RHSC) {
|
if (LHSC && RHSC) {
|
||||||
int64_t LV = LHSC->getValue()->getSExtValue();
|
APInt LV(LHSC->getValue()->getValue());
|
||||||
int64_t RV = RHSC->getValue()->getSExtValue();
|
APInt RV(RHSC->getValue()->getValue());
|
||||||
uint64_t ALV = (LV < 0) ? -LV : LV;
|
uint32_t MaxWidth = std::max(LV.getBitWidth(), RV.getBitWidth());
|
||||||
uint64_t ARV = (RV < 0) ? -RV : RV;
|
LV.sextOrTrunc(MaxWidth);
|
||||||
|
RV.sextOrTrunc(MaxWidth);
|
||||||
|
APInt ALV(LV.abs());
|
||||||
|
APInt ARV(RV.abs());
|
||||||
if (ALV == ARV)
|
if (ALV == ARV)
|
||||||
return LV > RV;
|
return LV.sgt(RV);
|
||||||
else
|
else
|
||||||
return ALV < ARV;
|
return ALV.ult(ARV);
|
||||||
}
|
}
|
||||||
return (LHSC && !RHSC);
|
return (LHSC && !RHSC);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
|
|||||||
switch (Opcode) {
|
switch (Opcode) {
|
||||||
default: break;
|
default: break;
|
||||||
case Instruction::And:
|
case Instruction::And:
|
||||||
if (CstVal->isNullValue()) { // ... & 0 -> 0
|
if (CstVal->isZero()) { // ... & 0 -> 0
|
||||||
++NumAnnihil;
|
++NumAnnihil;
|
||||||
return CstVal;
|
return CstVal;
|
||||||
} else if (CstVal->isAllOnesValue()) { // ... & -1 -> ...
|
} else if (CstVal->isAllOnesValue()) { // ... & -1 -> ...
|
||||||
@@ -544,10 +544,10 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Instruction::Mul:
|
case Instruction::Mul:
|
||||||
if (CstVal->isNullValue()) { // ... * 0 -> 0
|
if (CstVal->isZero()) { // ... * 0 -> 0
|
||||||
++NumAnnihil;
|
++NumAnnihil;
|
||||||
return CstVal;
|
return CstVal;
|
||||||
} else if (cast<ConstantInt>(CstVal)->isUnitValue()) {
|
} else if (cast<ConstantInt>(CstVal)->isOne()) {
|
||||||
Ops.pop_back(); // ... * 1 -> ...
|
Ops.pop_back(); // ... * 1 -> ...
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -559,7 +559,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
|
|||||||
// FALLTHROUGH!
|
// FALLTHROUGH!
|
||||||
case Instruction::Add:
|
case Instruction::Add:
|
||||||
case Instruction::Xor:
|
case Instruction::Xor:
|
||||||
if (CstVal->isNullValue()) // ... [|^+] 0 -> ...
|
if (CstVal->isZero()) // ... [|^+] 0 -> ...
|
||||||
Ops.pop_back();
|
Ops.pop_back();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -783,15 +783,15 @@ static FCmpInst::Predicate evaluateFCmpRelation(const Constant *V1,
|
|||||||
Constant *C2 = const_cast<Constant*>(V2);
|
Constant *C2 = const_cast<Constant*>(V2);
|
||||||
R = dyn_cast<ConstantInt>(
|
R = dyn_cast<ConstantInt>(
|
||||||
ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, C1, C2));
|
ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, C1, C2));
|
||||||
if (R && !R->isNullValue())
|
if (R && !R->isZero())
|
||||||
return FCmpInst::FCMP_OEQ;
|
return FCmpInst::FCMP_OEQ;
|
||||||
R = dyn_cast<ConstantInt>(
|
R = dyn_cast<ConstantInt>(
|
||||||
ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, C1, C2));
|
ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, C1, C2));
|
||||||
if (R && !R->isNullValue())
|
if (R && !R->isZero())
|
||||||
return FCmpInst::FCMP_OLT;
|
return FCmpInst::FCMP_OLT;
|
||||||
R = dyn_cast<ConstantInt>(
|
R = dyn_cast<ConstantInt>(
|
||||||
ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, C1, C2));
|
ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, C1, C2));
|
||||||
if (R && !R->isNullValue())
|
if (R && !R->isZero())
|
||||||
return FCmpInst::FCMP_OGT;
|
return FCmpInst::FCMP_OGT;
|
||||||
|
|
||||||
// Nothing more we can do
|
// Nothing more we can do
|
||||||
@@ -850,15 +850,15 @@ static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1,
|
|||||||
Constant *C2 = const_cast<Constant*>(V2);
|
Constant *C2 = const_cast<Constant*>(V2);
|
||||||
ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
|
ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
|
||||||
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
|
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
|
||||||
if (R && !R->isNullValue())
|
if (R && !R->isZero())
|
||||||
return pred;
|
return pred;
|
||||||
pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
|
pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
|
||||||
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
|
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
|
||||||
if (R && !R->isNullValue())
|
if (R && !R->isZero())
|
||||||
return pred;
|
return pred;
|
||||||
pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
|
pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
|
||||||
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
|
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
|
||||||
if (R && !R->isNullValue())
|
if (R && !R->isZero())
|
||||||
return pred;
|
return pred;
|
||||||
|
|
||||||
// If we couldn't figure it out, bail.
|
// If we couldn't figure it out, bail.
|
||||||
|
|||||||
Reference in New Issue
Block a user