[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Chris Lattner
clattner at apple.com
Tue Dec 5 11:52:02 PST 2006
> SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type
> *Ty) {
> if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
> - return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(),
> Ty));
> + return SCEVUnknown::get(
> + ConstantExpr::getTruncOrBitCast(SC->getValue(), Ty));
Shouldn't this one always bit a truncate?
> SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const
> Type *Ty) {
> if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
> - return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(),
> Ty));
> + return SCEVUnknown::get(
> + ConstantExpr::getZExtOrBitCast(SC->getValue(), Ty));
Likewise, always a zext?
> @@ -998,11 +1000,10 @@
> Constant *LHSCV = LHSC->getValue();
> Constant *RHSCV = RHSC->getValue();
> if (LHSCV->getType()->isUnsigned())
> - LHSCV = ConstantExpr::getInferredCast(
> - LHSCV, false, LHSCV->getType()->getSignedVersion(),
> true);
> + LHSCV = ConstantExpr::getBitCast(LHSCV,
> + LHSCV->getType()-
> >getSignedVersion());
> if (RHSCV->getType()->isUnsigned())
> - RHSCV = ConstantExpr::getInferredCast(
> - RHSCV, false, LHSCV->getType(), true);
> + RHSCV = ConstantExpr::getBitCast(RHSCV, LHSCV->getType());
> return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
> }
> }
As I mentioned before, these casts can all go away. sdiv is signless
now.
-Chris
More information about the llvm-commits
mailing list