[llvm-commits] PR8753

Chris Lattner clattner at apple.com
Wed Dec 8 23:42:55 PST 2010


On Dec 8, 2010, at 2:27 AM, Jakub Staszak wrote:

> Proposed patch for PR8753.
> 
> 
> --- lib/Transforms/Scalar/MemCpyOptimizer.cpp	(revision 121189)
> +++ lib/Transforms/Scalar/MemCpyOptimizer.cpp	(working copy)
> @@ -674,6 +674,14 @@
>   // other.
>   if (M->getSource() != MDep->getDest() || MDep->isVolatile())
>     return false;
> +
> +  // If dep instruction can be easily removed, don't bother. It also prevents
> +  // from infinie calculation for:
> +  //    memcpy(a <- a)
> +  //    memcpy(b <- a)
> +  // See: PR8753
> +  if (MDep->getSource() == MDep->getDest())
> +    return false;
> 
>   // Second, the length of the memcpy's must be the same, or the preceeding one
>   // must be larger than the following one.

Makes sense, I applied a slightly tweaked version of your patch in r121361, thanks!

-Chris



More information about the llvm-commits mailing list