[llvm-commits] [llvm] r114781 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Jim Grosbach
grosbach at apple.com
Fri Sep 24 21:20:11 PDT 2010
Eesh. That's a nasty one. Nice fix.
re: the TODO, I suspect the answer is "maybe." Not sure off the top of my head how to accurately model the change in cost, though.
On Sep 24, 2010, at 5:57 PM, Eric Christopher wrote:
> Author: echristo
> Date: Fri Sep 24 19:57:26 2010
> New Revision: 114781
>
> URL: http://llvm.org/viewvc/llvm-project?rev=114781&view=rev
> Log:
> If we're changing the source of a memcpy we need to use the alignment
> of the source, not the original alignment since it may no longer
> be valid.
>
> Fixes rdar://8400094
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=114781&r1=114780&r2=114781&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Fri Sep 24 19:57:26 2010
> @@ -697,14 +697,16 @@
> M->getParent()->getParent()->getParent(),
> M->getIntrinsicID(), ArgTys, 3);
>
> + // Make sure to use the alignment of the source since we're changing the
> + // location we're reading from.
> + // TODO: Is this worth it if we're creating a less aligned memcpy? For
> + // example we could be moving from movaps -> movq on x86.
> Value *Args[5] = {
> M->getRawDest(), MDep->getRawSource(), M->getLength(),
> - M->getAlignmentCst(), M->getVolatileCst()
> + MDep->getAlignmentCst(), M->getVolatileCst()
> };
> -
> CallInst *C = CallInst::Create(MemCpyFun, Args, Args+5, "", M);
>
> -
> // If C and M don't interfere, then this is a valid transformation. If they
> // did, this would mean that the two sources overlap, which would be bad.
> if (MD.getDependency(C) == dep) {
>
>
> _______________________________________________
> 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