[llvm-commits] [llvm] r50445 - in /llvm/branches/Apple/Tak: lib/Transforms/Scalar/MemCpyOptimizer.cpp test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll
Bill Wendling
isanbard at gmail.com
Tue Apr 29 14:40:13 PDT 2008
Author: void
Date: Tue Apr 29 16:40:13 2008
New Revision: 50445
URL: http://llvm.org/viewvc/llvm-project?rev=50445&view=rev
Log:
Porting r50444 into Tak.
Added:
llvm/branches/Apple/Tak/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll
Modified:
llvm/branches/Apple/Tak/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Modified: llvm/branches/Apple/Tak/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=50445&r1=50444&r2=50445&view=diff
==============================================================================
--- llvm/branches/Apple/Tak/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/branches/Apple/Tak/lib/Transforms/Scalar/MemCpyOptimizer.cpp Tue Apr 29 16:40:13 2008
@@ -615,10 +615,12 @@
if (dep == MemoryDependenceAnalysis::None ||
dep == MemoryDependenceAnalysis::NonLocal)
return false;
- else if (CallInst* C = dyn_cast<CallInst>(dep))
- return performCallSlotOptzn(M, C);
- else if (!isa<MemCpyInst>(dep))
- return false;
+ else if (!isa<MemCpyInst>(dep)) {
+ if (CallInst* C = dyn_cast<CallInst>(dep))
+ return performCallSlotOptzn(M, C);
+ else
+ return false;
+ }
MemCpyInst* MDep = cast<MemCpyInst>(dep);
Added: llvm/branches/Apple/Tak/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll?rev=50445&view=auto
==============================================================================
--- llvm/branches/Apple/Tak/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll (added)
+++ llvm/branches/Apple/Tak/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll Tue Apr 29 16:40:13 2008
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memcpy.*agg.result}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+ at x = external global { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+
+define void @foo({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind {
+entry:
+ %x.0 = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+ %x.01 = bitcast { x86_fp80, x86_fp80 }* %x.0 to i8* ; <i8*> [#uses=2]
+ call void @llvm.memcpy.i32( i8* %x.01, i8* bitcast ({ x86_fp80, x86_fp80 }* @x to i8*), i32 32, i32 16 )
+ %agg.result2 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %agg.result2, i8* %x.01, i32 32, i32 16 )
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
More information about the llvm-commits
mailing list