From: Dan Gohman Date: Tue, 21 Apr 2009 00:55:22 +0000 (+0000) Subject: Move some assertion checks so they can do more complete checking. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fb17fd2cdf35f8ad0b9e0e7e1b06a186fce442f8;p=oota-llvm.git Move some assertion checks so they can do more complete checking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69643 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 151ea743126..2a6cc50c0ba 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -201,10 +201,6 @@ SCEVTruncateExpr::SCEVTruncateExpr(const SCEVHandle &op, const Type *ty) assert((Op->getType()->isInteger() || isa(Op->getType())) && (Ty->isInteger() || isa(Ty)) && "Cannot truncate non-integer value!"); - assert((!Op->getType()->isInteger() || !Ty->isInteger() || - Op->getType()->getPrimitiveSizeInBits() > - Ty->getPrimitiveSizeInBits()) && - "This is not a truncating conversion!"); } SCEVTruncateExpr::~SCEVTruncateExpr() { @@ -255,8 +251,6 @@ SCEVSignExtendExpr::SCEVSignExtendExpr(const SCEVHandle &op, const Type *ty) assert((Op->getType()->isInteger() || isa(Op->getType())) && (Ty->isInteger() || isa(Ty)) && "Cannot sign extend non-integer value!"); - assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits() - && "This is not an extending conversion!"); } SCEVSignExtendExpr::~SCEVSignExtendExpr() { @@ -654,6 +648,10 @@ SCEVHandle SCEVAddRecExpr::evaluateAtIteration(SCEVHandle It, //===----------------------------------------------------------------------===// SCEVHandle ScalarEvolution::getTruncateExpr(const SCEVHandle &Op, const Type *Ty) { + assert(getTargetData().getTypeSizeInBits(Op->getType()) > + getTargetData().getTypeSizeInBits(Ty) && + "This is not a truncating conversion!"); + if (SCEVConstant *SC = dyn_cast(Op)) return getUnknown( ConstantExpr::getTrunc(SC->getValue(), Ty)); @@ -702,6 +700,10 @@ SCEVHandle ScalarEvolution::getZeroExtendExpr(const SCEVHandle &Op, } SCEVHandle ScalarEvolution::getSignExtendExpr(const SCEVHandle &Op, const Type *Ty) { + assert(getTargetData().getTypeSizeInBits(Op->getType()) < + getTargetData().getTypeSizeInBits(Ty) && + "This is not an extending conversion!"); + if (SCEVConstant *SC = dyn_cast(Op)) { const Type *IntTy = Ty; if (isa(IntTy)) IntTy = getTargetData().getIntPtrType();