diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2008-11-03 02:43:49 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2008-11-03 02:43:49 +0000 |
| commit | 7b14e20a5e83d3f5a076f12be1e6f42a1a222566 (patch) | |
| tree | 218bc5f5b9367fa598cd2ea13cea3cec71b9ce25 /llvm/lib/Analysis/ScalarEvolution.cpp | |
| parent | b067843863214ebd9032481e57605b181a198943 (diff) | |
| download | bcm5719-llvm-7b14e20a5e83d3f5a076f12be1e6f42a1a222566.tar.gz bcm5719-llvm-7b14e20a5e83d3f5a076f12be1e6f42a1a222566.zip | |
Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}).
We're still waiting on code that actually analyzes them properly.
llvm-svn: 58592
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index e0750053eb9..ceded879b0f 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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)); |

