aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-02 00:28:52 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-02 00:28:52 +0000
commitcae5754619433aed7be74abbf1c0551a82d369cb (patch)
tree77599913d2e900d4774e81cce3333f31f25c9fa6 /lib/Analysis/ScalarEvolution.cpp
parent34da0ac28f7bfe737f92d3a098697a6ebc09a25e (diff)
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
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 52b0af4e14..438e42886b 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -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 (cast<SCEVConstant>(Ops[0])->getValue()->isNullValue()) {
+ if (cast<SCEVConstant>(Ops[0])->getValue()->isZero()) {
Ops.erase(Ops.begin());
--Idx;
}
@@ -857,7 +857,7 @@ SCEVHandle SCEVMulExpr::get(std::vector<SCEVHandle> &Ops) {
if (cast<SCEVConstant>(Ops[0])->getValue()->equalsInt(1)) {
Ops.erase(Ops.begin());
--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.
return Ops[0];
}
@@ -1026,7 +1026,7 @@ SCEVHandle SCEVAddRecExpr::get(std::vector<SCEVHandle> &Operands,
if (Operands.size() == 1) return Operands[0];
if (SCEVConstant *StepC = dyn_cast<SCEVConstant>(Operands.back()))
- if (StepC->getValue()->isNullValue()) {
+ if (StepC->getValue()->isZero()) {
Operands.pop_back();
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 (SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
// 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.
}
@@ -2187,7 +2187,7 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
// should not accept a root of 2.
SCEVHandle Val = AddRec->evaluateAtIteration(R1);
if (SCEVConstant *EvalVal = dyn_cast<SCEVConstant>(Val))
- if (EvalVal->getValue()->isNullValue())
+ if (EvalVal->getValue()->isZero())
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 (SCEVConstant *SC = dyn_cast<SCEVConstant>(getStart()))
- if (!SC->getValue()->isNullValue()) {
+ if (!SC->getValue()->isZero()) {
std::vector<SCEVHandle> Operands(op_begin(), op_end());
Operands[0] = SCEVUnknown::getIntegerSCEV(0, SC->getType());
SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop());