diff options
author | Dan Gohman <gohman@apple.com> | 2009-05-01 16:44:18 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-05-01 16:44:18 +0000 |
commit | 194e42c612f2af8528d2199377da5fe329858061 (patch) | |
tree | 61e956b72ccff1b53f93d86b1061bfabf0a43940 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | cee10c5351b029645d5bc82a8431ae268464a15f (diff) | |
download | bcm5719-llvm-194e42c612f2af8528d2199377da5fe329858061.tar.gz bcm5719-llvm-194e42c612f2af8528d2199377da5fe329858061.zip |
When creating cast scevs, canonicalize the destination type. This
avoids duplicate scevs that differ only in type.
llvm-svn: 70549
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 3e2b7354a80..ae3eb48bf52 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -649,6 +649,9 @@ SCEVHandle SCEVAddRecExpr::evaluateAtIteration(SCEVHandle It, SCEVHandle ScalarEvolution::getTruncateExpr(const SCEVHandle &Op, const Type *Ty) { assert(getTypeSizeInBits(Op->getType()) > getTypeSizeInBits(Ty) && "This is not a truncating conversion!"); + assert(isSCEVable(Ty) && + "This is not a conversion to a SCEVable type!"); + Ty = getEffectiveSCEVType(Ty); if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op)) return getUnknown( @@ -689,6 +692,9 @@ SCEVHandle ScalarEvolution::getZeroExtendExpr(const SCEVHandle &Op, const Type *Ty) { assert(getTypeSizeInBits(Op->getType()) < getTypeSizeInBits(Ty) && "This is not an extending conversion!"); + assert(isSCEVable(Ty) && + "This is not a conversion to a SCEVable type!"); + Ty = getEffectiveSCEVType(Ty); if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op)) { const Type *IntTy = getEffectiveSCEVType(Ty); @@ -771,6 +777,9 @@ SCEVHandle ScalarEvolution::getSignExtendExpr(const SCEVHandle &Op, const Type *Ty) { assert(getTypeSizeInBits(Op->getType()) < getTypeSizeInBits(Ty) && "This is not an extending conversion!"); + assert(isSCEVable(Ty) && + "This is not a conversion to a SCEVable type!"); + Ty = getEffectiveSCEVType(Ty); if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op)) { const Type *IntTy = getEffectiveSCEVType(Ty); |