[llvm-commits] [llvm] r73401 - /llvm/trunk/lib/Analysis/IVUsers.cpp

Sanjiv Gupta sanjiv.gupta at microchip.com
Thu Jun 18 00:57:06 PDT 2009


Dan Gohman wrote:
> Author: djg
> Date: Mon Jun 15 13:38:59 2009
> New Revision: 73401
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73401&view=rev
> Log:
> Code cleanups. getSCEVAtScope no longer uses SCEVCouldNotCompute.
>
> Modified:
>     llvm/trunk/lib/Analysis/IVUsers.cpp
>
> Modified: llvm/trunk/lib/Analysis/IVUsers.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=73401&r1=73400&r2=73401&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/IVUsers.cpp (original)
> +++ llvm/trunk/lib/Analysis/IVUsers.cpp Mon Jun 15 13:38:59 2009
> @@ -120,9 +120,9 @@
>    // Use getSCEVAtScope to attempt to simplify other loops out of
>    // the picture.
>    SCEVHandle AddRecStart = AddRec->getStart();
> -  SCEVHandle BetterAddRecStart = SE->getSCEVAtScope(AddRecStart, UseLoop);
> -  if (!isa<SCEVCouldNotCompute>(BetterAddRecStart))
> -    AddRecStart = BetterAddRecStart;
> +  AddRecStart = SE->getSCEVAtScope(AddRecStart, UseLoop);
> +  SCEVHandle AddRecStride = AddRec->getStepRecurrence(*SE);
> +  AddRecStride = SE->getSCEVAtScope(AddRecStride, UseLoop);
>  
>   
Dan,

Since you meant only code cleanup, the last line I think is left there 
by mistake as in the original code we had only one call to

SE->getSCEVAtScope(AddRecStart, UseLoop); which is already there two lines above.

- Sanjiv


>    // FIXME: If Start contains an SCEVAddRecExpr from a different loop, other
>    // than an outer loop of the current loop, reject it.  LSR has no concept of
> @@ -136,18 +136,18 @@
>  
>    Start = SE->getAddExpr(Start, AddRecStart);
>  
> -  if (!isa<SCEVConstant>(AddRec->getStepRecurrence(*SE))) {
> -    // If stride is an instruction, make sure it dominates the loop preheader.
> -    // Otherwise we could end up with a use before def situation.
> +  // If stride is an instruction, make sure it dominates the loop preheader.
> +  // Otherwise we could end up with a use before def situation.
> +  if (!isa<SCEVConstant>(AddRecStride)) {
>      BasicBlock *Preheader = L->getLoopPreheader();
> -    if (!AddRec->getStepRecurrence(*SE)->dominates(Preheader, DT))
> +    if (!AddRecStride->dominates(Preheader, DT))
>        return false;
>  
>      DOUT << "[" << L->getHeader()->getName()
>           << "] Variable stride: " << *AddRec << "\n";
>    }
>  
> -  Stride = AddRec->getStepRecurrence(*SE);
> +  Stride = AddRecStride;
>    isSigned = isSExt;
>    return true;
>  }
> @@ -326,7 +326,7 @@
>    // Evaluate the expression out of the loop, if possible.
>    if (!L->contains(U.getUser()->getParent())) {
>      SCEVHandle ExitVal = SE->getSCEVAtScope(RetVal, L->getParentLoop());
> -    if (!isa<SCEVCouldNotCompute>(ExitVal) && ExitVal->isLoopInvariant(L))
> +    if (ExitVal->isLoopInvariant(L))
>        RetVal = ExitVal;
>    }
>    // Promote the result to the type of the use.
>
>
> _______________________________________________
> 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