[llvm-commits] [llvm] r139136 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Eli Friedman eli.friedman at gmail.com
Mon Sep 5 23:55:54 PDT 2011


On Mon, Sep 5, 2011 at 11:39 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Author: nicholas
> Date: Tue Sep  6 01:39:54 2011
> New Revision: 139136
>
> URL: http://llvm.org/viewvc/llvm-project?rev=139136&view=rev
> Log:
> Nope! I had it right the first time. Revert the operative part of r139135 and
> add more showing of my work.

Commit message not consistent with the commit.

-Eli

> Modified:
>    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>
> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=139136&r1=139135&r2=139136&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Sep  6 01:39:54 2011
> @@ -652,7 +652,7 @@
>  /// Assume, K > 0.
>  static const SCEV *BinomialCoefficient(const SCEV *It, unsigned K,
>                                        ScalarEvolution &SE,
> -                                       Type* ResultTy) {
> +                                       Type *ResultTy) {
>   // Handle the simplest case efficiently.
>   if (K == 1)
>     return SE.getTruncateOrZeroExtend(It, ResultTy);
> @@ -1976,12 +1976,15 @@
>          OtherIdx < Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]);
>          ++OtherIdx)
>       if (AddRecLoop == cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()) {
> -        // {A,+,B}<L> * {C,+,D}<L>  -->  {A*C,+,A*D + B*C - B*D,+,2*B*D}<L>
> +        // {A,+,B}<L> * {C,+,D}<L>  -->  {A*C,+,A*D + B*C + B*D,+,2*B*D}<L>
>         //
> -        // For reference, given that {X,+,Y,+,Z} = x + y*It + z*It^2 then
> -        // X = x, Y = y-z, Z = 2z.
> +        // {A,+,B} * {C,+,D} = A+It*B * C+It*D = A*C + (A*D + B*C)*It + B*D*It^2
> +        // Given an equation of the form x + y*It + z*It^2 (above), we want to
> +        // express it in terms of {X,+,Y,+,Z}.
> +        // {X,+,Y,+,Z} = X + Y*It + Z*(It^2 - It)/2.
> +        // Rearranging, X = x, Y = x+y, Z = 2z.
>         //
> -        // x = A*C, y = (A*D + B*C), z = B*D
> +        // x = A*C, y = (A*D + B*C), z = B*D.
>         // Therefore X = A*C, Y = (A*D + B*C) - B*D and Z = 2*B*D.
>         for (; OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]);
>              ++OtherIdx)
>
>
> _______________________________________________
> 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