[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Reid Spencer
reid at x10sys.com
Fri Mar 2 15:38:10 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
LoopStrengthReduce.cpp updated: 1.112 -> 1.113
---
Log message:
Dang, I've done that twice now! Undo previous commit.
---
Diffs of the changes: (+11 -12)
LoopStrengthReduce.cpp | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.112 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.113
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.112 Fri Mar 2 17:35:28 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Mar 2 17:37:53 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()->isZero())
+ if (SC->getValue()->isNullValue())
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()->isZero()) {
+ !cast<SCEVConstant>(Expr)->getValue()->isNullValue()) {
// 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()->isZero();
+ return SC->getValue()->getZExtValue() == 0;
return false;
}
@@ -883,18 +883,17 @@
if (!TLI) return 0;
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride)) {
- APInt SInt(SC->getValue()->getValue());
- if (SInt == 1)
- return 0;
+ int64_t SInt = SC->getValue()->getSExtValue();
+ if (SInt == 1) return 0;
for (TargetLowering::legal_am_scale_iterator
I = TLI->legal_am_scale_begin(), E = TLI->legal_am_scale_end();
I != E; ++I) {
- APInt Scale(SInt.getBitWidth(), *I);
- if (SInt.abs().ult(Scale) || SInt.srem(Scale) != 0)
+ unsigned Scale = *I;
+ if (unsigned(abs(SInt)) < Scale || (SInt % Scale) != 0)
continue;
std::map<SCEVHandle, IVsOfOneStride>::iterator SI =
- IVsByStride.find(SCEVUnknown::getIntegerSCEV(SInt.sdiv(Scale)));
+ IVsByStride.find(SCEVUnknown::getIntegerSCEV(SInt/Scale, UIntPtrTy));
if (SI == IVsByStride.end())
continue;
for (std::vector<IVExpr>::iterator II = SI->second.IVs.begin(),
@@ -903,7 +902,7 @@
// Only reuse previous IV if it would not require a type conversion.
if (isZero(II->Base) && II->Base->getType() == Ty) {
IV = *II;
- return Scale.getZExtValue();
+ return Scale;
}
}
}
@@ -1149,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)->isZero())
+ !cast<ConstantInt>(CommonBaseV)->isNullValue())
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)->isZero())
+ if (!isa<ConstantInt>(BaseV) || !cast<ConstantInt>(BaseV)->isNullValue())
// Add BaseV to the PHI value if needed.
RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV));
More information about the llvm-commits
mailing list