aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-11-03 02:43:49 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-11-03 02:43:49 +0000
commit8f4d5eb9e543d22df61a98c4115ed81887213333 (patch)
tree04066da191d4667976b4a33ffb275ab223c9d3a2 /lib/Analysis/ScalarEvolution.cpp
parentae61ca02061cc500cb9f093a492899658249a245 (diff)
Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}).
We're still waiting on code that actually analyzes them properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index e0750053eb..ceded879b0 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2604,6 +2604,11 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) {
// The divisions must be performed as signed divisions.
APInt NegB(-B);
APInt TwoA( A << 1 );
+ if (TwoA.isMinValue()) {
+ SCEV *CNC = new SCEVCouldNotCompute();
+ return std::make_pair(CNC, CNC);
+ }
+
ConstantInt *Solution1 = ConstantInt::get((NegB + SqrtVal).sdiv(TwoA));
ConstantInt *Solution2 = ConstantInt::get((NegB - SqrtVal).sdiv(TwoA));