[llvm-commits] [llvm] r69643 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Dan Gohman gohman at apple.com
Mon Apr 20 17:55:22 PDT 2009


Author: djg
Date: Mon Apr 20 19:55:22 2009
New Revision: 69643

URL: http://llvm.org/viewvc/llvm-project?rev=69643&view=rev
Log:
Move some assertion checks so they can do more complete checking.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=69643&r1=69642&r2=69643&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Apr 20 19:55:22 2009
@@ -201,10 +201,6 @@
   assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
          (Ty->isInteger() || isa<PointerType>(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 @@
   assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
          (Ty->isInteger() || isa<PointerType>(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 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<SCEVConstant>(Op))
     return getUnknown(
         ConstantExpr::getTrunc(SC->getValue(), Ty));
@@ -702,6 +700,10 @@
 }
 
 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<SCEVConstant>(Op)) {
     const Type *IntTy = Ty;
     if (isa<PointerType>(IntTy)) IntTy = getTargetData().getIntPtrType();





More information about the llvm-commits mailing list