diff options
| author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-04-08 10:27:40 +0000 |
|---|---|---|
| committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-04-08 10:27:40 +0000 |
| commit | b47cbe1c72caf9fdcc05369bcc07b82255408f28 (patch) | |
| tree | 1d0276264da78311517fe2ea9f2314c967663c70 /polly/lib/Support | |
| parent | e85d50defbdd626305b92648787abf5b9aebf80c (diff) | |
| download | bcm5719-llvm-b47cbe1c72caf9fdcc05369bcc07b82255408f28.tar.gz bcm5719-llvm-b47cbe1c72caf9fdcc05369bcc07b82255408f28.zip | |
[FIX] Handle multiplications in the SCEVAffinator again
If ScalarEvolution cannot look through some expression but we do, it
might happen that a multiplication will arrive at the
SCEVAffinator::visitMulExpr. While we could always try to improve the
extractConstantFactor function we might still miss something, thus we
reintroduce the code to generate multiplicative piecewise-affine
functions as a fall-back.
llvm-svn: 265777
Diffstat (limited to 'polly/lib/Support')
| -rw-r--r-- | polly/lib/Support/SCEVAffinator.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/polly/lib/Support/SCEVAffinator.cpp b/polly/lib/Support/SCEVAffinator.cpp index a9e542c25f0..e1520c8d284 100644 --- a/polly/lib/Support/SCEVAffinator.cpp +++ b/polly/lib/Support/SCEVAffinator.cpp @@ -268,7 +268,16 @@ __isl_give isl_pw_aff *SCEVAffinator::visitAddExpr(const SCEVAddExpr *Expr) { } __isl_give isl_pw_aff *SCEVAffinator::visitMulExpr(const SCEVMulExpr *Expr) { - llvm_unreachable("SCEVMulExpr should not be reached"); + isl_pw_aff *Prod = visit(Expr->getOperand(0)); + + for (int i = 1, e = Expr->getNumOperands(); i < e; ++i) { + isl_pw_aff *NextFactor = visit(Expr->getOperand(i)); + Prod = isl_pw_aff_mul(Prod, NextFactor); + if (isToComplex(Prod)) + return nullptr; + } + + return Prod; } __isl_give isl_pw_aff *SCEVAffinator::visitUDivExpr(const SCEVUDivExpr *Expr) { |

