summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDeclCXX.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-18 06:20:47 +0000
committerChris Lattner <sabre@nondot.org>2010-11-18 06:20:47 +0000
commit7aeae25c78197800a931d56a10cad062a7711a46 (patch)
treecb2e80ff4e2d2e15d7696b4b8ea0b5ca4fbb64bb /clang/lib/CodeGen/CGDeclCXX.cpp
parent943418414236999bbacd42f0f042240a271e77c1 (diff)
downloadbcm5719-llvm-7aeae25c78197800a931d56a10cad062a7711a46.tar.gz
bcm5719-llvm-7aeae25c78197800a931d56a10cad062a7711a46.zip
fix a small oversight in the "eliminate memcpy from constant global"
optimization. If the alloca that is "memcpy'd from constant" also has a memcpy from *it*, ignore it: it is a load. We now optimize the testcase to: define void @test2() { %B = alloca %T %a = bitcast %T* @G to i8* %b = bitcast %T* %B to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 124, i32 4, i1 false) call void @bar(i8* %b) ret void } previously we would generate: define void @test() { %B = alloca %T %b = bitcast %T* %B to i8* %G.0 = getelementptr inbounds %T* @G, i32 0, i32 0 %tmp3 = load i8* %G.0, align 4 %G.1 = getelementptr inbounds %T* @G, i32 0, i32 1 %G.15 = bitcast [123 x i8]* %G.1 to i8* %1 = bitcast [123 x i8]* %G.1 to i984* %srcval = load i984* %1, align 1 %B.0 = getelementptr inbounds %T* %B, i32 0, i32 0 store i8 %tmp3, i8* %B.0, align 4 %B.1 = getelementptr inbounds %T* %B, i32 0, i32 1 %B.12 = bitcast [123 x i8]* %B.1 to i8* %2 = bitcast [123 x i8]* %B.1 to i984* store i984 %srcval, i984* %2, align 1 call void @bar(i8* %b) ret void } llvm-svn: 119682
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud