[llvm] r186845 - Fix an obvious typo in the loop vectorizer where the cost model uses the wrong variable. The variable BlockCost is ignored.

Nadav Rotem nrotem at apple.com
Mon Jul 22 10:14:25 PDT 2013


I forgot to mention that this fix is from "Zakk <zakk0610 at gmail.com>"

On 07/22/13, Nadav Rotem  <nrotem at apple.com> wrote:
> Author: nadav
> Date: Mon Jul 22 12:10:48 2013
> New Revision: 186845
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=186845&view=rev
> Log:
> Fix an obvious typo in the loop vectorizer where the cost model uses the wrong variable. The variable BlockCost is ignored.
> We don't have tests for the effect of if-conversion loops because it requires a big test (that includes if-converted loops) and it is difficult to find and balance a loop to do the right thing.
> 
> 
> Modified:
>     llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
> 
> Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=186845&r1=186844&r2=186845&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
> +++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Mon Jul 22 12:10:48 2013
> @@ -4390,7 +4390,7 @@ unsigned LoopVectorizationCostModel::exp
>          continue;
>  
>        unsigned C = getInstructionCost(it, VF);
> -      Cost += C;
> +      BlockCost += C;
>        DEBUG(dbgs() << "LV: Found an estimated cost of "<< C <<" for VF " <<
>              VF << " For instruction: "<< *it << "\n");
>      }
> @@ -4398,7 +4398,7 @@ unsigned LoopVectorizationCostModel::exp
>      // We assume that if-converted blocks have a 50% chance of being executed.
>      // When the code is scalar then some of the blocks are avoided due to CF.
>      // When the code is vectorized we execute all code paths.
> -    if (Legal->blockNeedsPredication(*bb) && VF == 1)
> +    if (VF == 1 && Legal->blockNeedsPredication(*bb))
>        BlockCost /= 2;
>  
>      Cost += BlockCost;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130722/088626c1/attachment.html>


More information about the llvm-commits mailing list