diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-06 05:29:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-06 05:29:56 +0000 |
commit | bc9a28dd544e37074693333ea96c508a3d3bc3b4 (patch) | |
tree | f1b8c55917c0a3bc7b96605763a0c26876a28220 /test/Transforms | |
parent | cb9cbc494975dc827465af32d806e7b9ae17090c (diff) | |
download | external_llvm-bc9a28dd544e37074693333ea96c508a3d3bc3b4.zip external_llvm-bc9a28dd544e37074693333ea96c508a3d3bc3b4.tar.gz external_llvm-bc9a28dd544e37074693333ea96c508a3d3bc3b4.tar.bz2 |
constant fold loads from memcpy's from global constants. This is important
because clang lowers nontrivial automatic struct/array inits to memcpy from
a global array.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90698 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/GVN/rle.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll index af02557..e667eec 100644 --- a/test/Transforms/GVN/rle.ll +++ b/test/Transforms/GVN/rle.ll @@ -187,8 +187,24 @@ Cont: ; CHECK: ret i16 %A } +@GCst = constant {i32, float, i32 } { i32 42, float 14., i32 97 } + +; memset -> float forwarding. +define float @memcpy_to_float_local(float* %A) nounwind ssp { +entry: + %conv = bitcast float* %A to i8* ; <i8*> [#uses=1] + tail call void @llvm.memcpy.i64(i8* %conv, i8* bitcast ({i32, float, i32 }* @GCst to i8*), i64 12, i32 1) + %arrayidx = getelementptr inbounds float* %A, i64 1 ; <float*> [#uses=1] + %tmp2 = load float* %arrayidx ; <float> [#uses=1] + ret float %tmp2 +; CHECK: @memcpy_to_float_local +; CHECK-NOT: load +; CHECK: ret float 1.400000e+01 +} + declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind +declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind |