summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
authorRoman Gareev <gareevroman@gmail.com>2015-12-17 20:37:17 +0000
committerRoman Gareev <gareevroman@gmail.com>2015-12-17 20:37:17 +0000
commit8aa437503cfcc8f84324f5dc7e0e8209904bc774 (patch)
treecddf1c526525824936dade45d9da6237c0d88b6a /polly/lib/Analysis/ScopDetection.cpp
parent0de2feceb1dd0aebbba4fe98032d7ecb46b0e663 (diff)
downloadbcm5719-llvm-8aa437503cfcc8f84324f5dc7e0e8209904bc774.tar.gz
bcm5719-llvm-8aa437503cfcc8f84324f5dc7e0e8209904bc774.zip
Fix delinearization of fortran arrays
The patch fixes Bug 25759 produced by inappropriate handling of unsigned maximum SCEV expressions by SCEVRemoveMax. Without a fix, we get an infinite loop and a segmentation fault, if we try to process, for example, '((-1 + (-1 * %b1)) umax {(-1 + (-1 * %yStart)),+,-1}<%.preheader>)'. It also fixes a potential issue related to signed maximum SCEV expressions. Tested-by: Roman Gareev <gareevroman@gmail.com> Fixed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: http://reviews.llvm.org/D15563 llvm-svn: 255922
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 778ebff7158..b360419d894 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -524,7 +524,7 @@ public:
const SCEV *visitUDivExpr(const SCEVUDivExpr *Expr) { return Expr; }
const SCEV *visitSMaxExpr(const SCEVSMaxExpr *Expr) {
- if (Expr->getOperand(0)->isZero()) {
+ if ((Expr->getNumOperands() == 2) and Expr->getOperand(0)->isZero()) {
auto Res = visit(Expr->getOperand(1));
if (Terms)
(*Terms).push_back(Res);
@@ -534,7 +534,7 @@ public:
return Expr;
}
- const SCEV *visitUMaxExpr(const SCEVUMaxExpr *Expr) { return visit(Expr); }
+ const SCEV *visitUMaxExpr(const SCEVUMaxExpr *Expr) { return Expr; }
const SCEV *visitUnknown(const SCEVUnknown *Expr) { return Expr; }
OpenPOWER on IntegriCloud