From: Chris Lattner Date: Sun, 15 Apr 2007 19:52:49 +0000 (+0000) Subject: Fix a nasty bug introduced when apint'ified. This fixes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fe560b8c8529bd2380452a9713eb591c545c4301;p=oota-llvm.git Fix a nasty bug introduced when apint'ified. This fixes Transforms/IndVarsSimplify/exit_value_tests.llx git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36081 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index bbb59d52c16..54848e96a21 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2096,9 +2096,9 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { } uint32_t BitWidth = LC->getValue()->getValue().getBitWidth(); - const APInt& L = LC->getValue()->getValue(); - const APInt& M = MC->getValue()->getValue(); - const APInt& N = MC->getValue()->getValue(); + const APInt &L = LC->getValue()->getValue(); + const APInt &M = MC->getValue()->getValue(); + const APInt &N = NC->getValue()->getValue(); APInt Two(BitWidth, 2); APInt Four(BitWidth, 4); @@ -2125,7 +2125,7 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { // Compute the two solutions for the quadratic formula. // The divisions must be performed as signed divisions. APInt NegB(-B); - APInt TwoA( A * Two ); + APInt TwoA(A << 1); ConstantInt *Solution1 = ConstantInt::get((NegB + SqrtVal).sdiv(TwoA)); ConstantInt *Solution2 = ConstantInt::get((NegB - SqrtVal).sdiv(TwoA));