aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-16 19:25:55 +0000
committerDan Gohman <gohman@apple.com>2009-04-16 19:25:55 +0000
commit8170a6849ed370059676f94d8a00ae652873a394 (patch)
tree36aef840f9443704bb9d58e8fd8f4eb7ecdaaba4 /lib/Analysis/ScalarEvolution.cpp
parent02f8c410148ba3b6009ed67df41e2c97c1c07c3a (diff)
Fix a bug with inttoptr/ptrtoint casts where the pointer has a different
size from the integer, requiring zero extension or truncation. Don't create ZExtInsts with pointer types. This fixes a regression in consumer-jpeg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 972e4e984c..a3a6ff3333 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -225,8 +225,6 @@ SCEVZeroExtendExpr::SCEVZeroExtendExpr(const SCEVHandle &op, const Type *ty)
assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
(Ty->isInteger() || isa<PointerType>(Ty)) &&
"Cannot zero extend non-integer value!");
- assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()
- && "This is not an extending conversion!");
}
SCEVZeroExtendExpr::~SCEVZeroExtendExpr() {
@@ -674,7 +672,12 @@ SCEVHandle ScalarEvolution::getTruncateExpr(const SCEVHandle &Op, const Type *Ty
return Result;
}
-SCEVHandle ScalarEvolution::getZeroExtendExpr(const SCEVHandle &Op, const Type *Ty) {
+SCEVHandle ScalarEvolution::getZeroExtendExpr(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();