[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Reid Spencer
reid at x10sys.com
Fri Mar 2 15:51:42 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
LoopStrengthReduce.cpp updated: 1.113 -> 1.114
---
Log message:
Finally get this patch right :)
Replace expensive getZExtValue() == 0 calls with isZero() calls.
---
Diffs of the changes: (+5 -5)
LoopStrengthReduce.cpp | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.113 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.114
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.113 Fri Mar 2 17:37:53 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Mar 2 17:51:25 2007
@@ -540,7 +540,7 @@
// If there is no immediate value, skip the next part.
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Imm))
- if (SC->getValue()->isNullValue())
+ if (SC->getValue()->isZero())
return Rewriter.expandCodeFor(NewBase, BaseInsertPt,
OperandValToReplace->getType());
@@ -779,7 +779,7 @@
SeparateSubExprs(SubExprs, SARE->getOperand(0));
}
} else if (!isa<SCEVConstant>(Expr) ||
- !cast<SCEVConstant>(Expr)->getValue()->isNullValue()) {
+ !cast<SCEVConstant>(Expr)->getValue()->isZero()) {
// Do not add zero.
SubExprs.push_back(Expr);
}
@@ -869,7 +869,7 @@
///
static bool isZero(SCEVHandle &V) {
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V))
- return SC->getValue()->getZExtValue() == 0;
+ return SC->getValue()->isZero();
return false;
}
@@ -1148,14 +1148,14 @@
// are reusing an IV, it has not been used to initialize the PHI node.
// Add it to the expression used to rewrite the uses.
if (!isa<ConstantInt>(CommonBaseV) ||
- !cast<ConstantInt>(CommonBaseV)->isNullValue())
+ !cast<ConstantInt>(CommonBaseV)->isZero())
RewriteExpr = SCEVAddExpr::get(RewriteExpr,
SCEVUnknown::get(CommonBaseV));
}
// Now that we know what we need to do, insert code before User for the
// 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.
RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV));
More information about the llvm-commits
mailing list