[PATCH] Loop Vectorizer Debug Info

Nadav Rotem nrotem at apple.com
Fri Oct 11 09:10:54 PDT 2013


Thanks Renato!   This LGTM. 



On Oct 11, 2013, at 7:45 AM, Renato Golin <renato.golin at linaro.org> wrote:

> Hi nadav,
> 
> Just moving code around to make it easier to spot basic-blocks of loops that can't be if-converted. No functional change.
> 
> http://llvm-reviews.chandlerc.com/D1897
> 
> Files:
>  lib/Transforms/Vectorize/LoopVectorize.cpp
> 
> Index: lib/Transforms/Vectorize/LoopVectorize.cpp
> ===================================================================
> --- lib/Transforms/Vectorize/LoopVectorize.cpp
> +++ lib/Transforms/Vectorize/LoopVectorize.cpp
> @@ -2745,19 +2745,17 @@
>   if (!TheLoop->getExitingBlock())
>     return false;
> 
> -  unsigned NumBlocks = TheLoop->getNumBlocks();
> +  // We need to have a loop header.
> +  DEBUG(dbgs() << "LV: Found a loop: " <<
> +        TheLoop->getHeader()->getName() << '\n');
> 
>   // Check if we can if-convert non single-bb loops.
> +  unsigned NumBlocks = TheLoop->getNumBlocks();
>   if (NumBlocks != 1 && !canVectorizeWithIfConvert()) {
>     DEBUG(dbgs() << "LV: Can't if-convert the loop.\n");
>     return false;
>   }
> 
> -  // We need to have a loop header.
> -  BasicBlock *Latch = TheLoop->getLoopLatch();
> -  DEBUG(dbgs() << "LV: Found a loop: " <<
> -        TheLoop->getHeader()->getName() << '\n');
> -
>   // ScalarEvolution needs to be able to find the exit count.
>   const SCEV *ExitCount = SE->getBackedgeTakenCount(TheLoop);
>   if (ExitCount == SE->getCouldNotCompute()) {
> @@ -2766,6 +2764,7 @@
>   }
> 
>   // Do not loop-vectorize loops with a tiny trip count.
> +  BasicBlock *Latch = TheLoop->getLoopLatch();
>   unsigned TC = SE->getSmallConstantTripCount(TheLoop, Latch);
>   if (TC > 0u && TC < TinyTripCountVectorThreshold) {
>     DEBUG(dbgs() << "LV: Found a loop with a very small trip count. " <<
> <D1897.1.patch>




More information about the llvm-commits mailing list