[llvm-commits] [llvm] r145865 - in /llvm/trunk: lib/Transforms/Scalar/MemCpyOptimizer.cpp test/Transforms/MemCpyOpt/form-memset.ll
Bob Wilson
bob.wilson at apple.com
Mon Dec 5 14:42:45 PST 2011
I think you meant <rdar://problem/9892684>
On Dec 5, 2011, at 2:37 PM, Chad Rosier wrote:
> Author: mcrosier
> Date: Mon Dec 5 16:37:00 2011
> New Revision: 145865
>
> URL: http://llvm.org/viewvc/llvm-project?rev=145865&view=rev
> Log:
> Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerio
> where this would be bad as the backend shouldn't have a problem inlining small
> memcpys.
> rdar://10510150
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
>
> Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=145865&r1=145864&r2=145865&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Dec 5 16:37:00 2011
> @@ -148,7 +148,7 @@
>
> bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
> // If we found more than 8 stores to merge or 64 bytes, use memset.
> - if (TheStores.size() >= 8 || End-Start >= 64) return true;
> + if (TheStores.size() >= 4 || End-Start >= 16) return true;
>
> // If there is nothing to merge, don't do anything.
> if (TheStores.size() < 2) return false;
>
> Modified: llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll?rev=145865&r1=145864&r2=145865&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll (original)
> +++ llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll Mon Dec 5 16:37:00 2011
> @@ -57,8 +57,8 @@
>
> declare i32 @bar(...)
>
> +%struct.MV = type { i16, i16 }
>
> - %struct.MV = type { i16, i16 }
>
> define void @test2() nounwind {
> entry:
> @@ -220,3 +220,19 @@
> ; CHECK: call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 24, i32 1, i1 false)
> }
>
> +; More aggressive heuristic
> +; rdar://9892684
> +define void @test7(i32* nocapture %c) nounwind optsize {
> + store i32 -1, i32* %c, align 4
> + %1 = getelementptr inbounds i32* %c, i32 1
> + store i32 -1, i32* %1, align 4
> + %2 = getelementptr inbounds i32* %c, i32 2
> + store i32 -1, i32* %2, align 4
> + %3 = getelementptr inbounds i32* %c, i32 3
> + store i32 -1, i32* %3, align 4
> + %4 = getelementptr inbounds i32* %c, i32 4
> + store i32 -1, i32* %4, align 4
> +; CHECK: @test7
> +; CHECK: call void @llvm.memset.p0i8.i64(i8* %5, i8 -1, i64 20, i32 4, i1 false)
> + ret void
> +}
>
>
> _______________________________________________
> 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