summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorSebastian Pop <spop@codeaurora.org>2014-04-08 21:21:05 +0000
committerSebastian Pop <spop@codeaurora.org>2014-04-08 21:21:05 +0000
commitb5b84e0963a985d0e7b21b0aa5484a4b5a7d4768 (patch)
tree4b60d0d0ddb38e15bba923ee6493e4af21e1231f /llvm/lib/Analysis/ScalarEvolution.cpp
parent1801668af3cbc51a1f8bab552f3896eb30268cfa (diff)
downloadbcm5719-llvm-b5b84e0963a985d0e7b21b0aa5484a4b5a7d4768.tar.gz
bcm5719-llvm-b5b84e0963a985d0e7b21b0aa5484a4b5a7d4768.zip
in findGCD of multiply expr return the gcd
we used to return 1 instead of the gcd llvm-svn: 205800
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 08de6213e22..d6165111dba 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6962,10 +6962,12 @@ public:
if (PartialGCD != One)
return PartialGCD;
+ // Failed to find a PartialGCD: set the Remainder to the full expression,
+ // and return the GCD.
Remainder = Expr;
const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(GCD);
if (!Mul)
- return PartialGCD;
+ return GCD;
// When the GCD is a multiply expression, try to decompose it:
// this occurs when Step does not divide the Start expression
@@ -6979,7 +6981,7 @@ public:
}
}
- return PartialGCD;
+ return GCD;
}
const SCEV *visitUDivExpr(const SCEVUDivExpr *Expr) {
OpenPOWER on IntegriCloud