[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Chris Lattner clattner at apple.com
Sun Apr 15 19:17:11 PDT 2007


> ScalarEvolution.cpp updated: 1.110 -> 1.111
> ---
> Log message:
>
> For PR1336: http://llvm.org/PR1336 :
> Fix a div-by-zero bug noticed by APInt. This fixes:
> test/Transforms/IndVarsSimplify/exit_value_tests.llx

Please revert this immediately.  The bug was already fixed and this  
is not at all correct.

-Chris

>
> ---
> Diffs of the changes:  (+6 -1)
>
>  ScalarEvolution.cpp |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletion(-)
>
>
> Index: llvm/lib/Analysis/ScalarEvolution.cpp
> diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.110 llvm/lib/ 
> Analysis/ScalarEvolution.cpp:1.111
> --- llvm/lib/Analysis/ScalarEvolution.cpp:1.110	Sun Apr 15 14:52:49  
> 2007
> +++ llvm/lib/Analysis/ScalarEvolution.cpp	Sun Apr 15 20:48:37 2007
> @@ -2125,7 +2125,12 @@
>      // Compute the two solutions for the quadratic formula.
>      // The divisions must be performed as signed divisions.
>      APInt NegB(-B);
> -    APInt TwoA(A << 1);
> +    APInt TwoA( A << Two );
> +    if (TwoA == 0) {
> +      const Type* Ty = LC->getValue()->getType();
> +      return std::make_pair(SCEVUnknown::get(UndefValue::get(Ty)),
> +                            SCEVUnknown::get(UndefValue::get(Ty)));
> +    }
>      ConstantInt *Solution1 = ConstantInt::get((NegB + SqrtVal).sdiv 
> (TwoA));
>      ConstantInt *Solution2 = ConstantInt::get((NegB - SqrtVal).sdiv 
> (TwoA));
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list