[llvm-commits] [llvm] r122678 - in /llvm/trunk: lib/Transforms/Scalar/LoopIdiomRecognize.cpp test/Transforms/LoopIdiom/basic.ll

Frits van Bommel fvbommel at gmail.com
Sun Jan 2 02:08:52 PST 2011


On Sun, Jan 2, 2011 at 4:37 AM, Chris Lattner <sabre at nondot.org> wrote:
> +/// processLoopStoreOfLoopLoad - We see a strided store whose value is a
> +/// same-strided load.
> +bool LoopIdiomRecognize::
> +processLoopStoreOfLoopLoad(StoreInst *SI, unsigned StoreSize,
> +                           const SCEVAddRecExpr *StoreEv,
> +                           const SCEVAddRecExpr *LoadEv,
> +                           const SCEV *BECount) {
> +  LoadInst *LI = cast<LoadInst>(SI->getValueOperand());
> +
> +  // Okay, we have a strided store "p[i]" of a loaded value.  We can turn
> +  // this into a memcmp in the loop preheader now if we want.  However, this

s/memcmp/memcpy/

> +  // would be unsafe to do if there is anything else in the loop that may read
> +  // or write to the aliased location (including the load feeding the stores).
> +  // Check for an alias.

TODO: If *only* the load feeding the stores aliases them, turn it into
memmove instead :). (unless the load has other uses)




More information about the llvm-commits mailing list