diff options
author | Owen Anderson <resistor@mac.com> | 2008-03-13 22:07:10 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-03-13 22:07:10 +0000 |
commit | 78a334f549e9f671d5abcaf0bae5ba5311a31f92 (patch) | |
tree | 905cd8e0354587610a352135dad5972c6703193f /test/Transforms | |
parent | ed5fb3b5badcc0274c2ed561765b5327db2fda01 (diff) | |
download | external_llvm-78a334f549e9f671d5abcaf0bae5ba5311a31f92.zip external_llvm-78a334f549e9f671d5abcaf0bae5ba5311a31f92.tar.gz external_llvm-78a334f549e9f671d5abcaf0bae5ba5311a31f92.tar.bz2 |
Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/GVN/2008-03-13-ReturnSlotBitcast.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Transforms/GVN/2008-03-13-ReturnSlotBitcast.ll b/test/Transforms/GVN/2008-03-13-ReturnSlotBitcast.ll new file mode 100644 index 0000000..7757a92 --- /dev/null +++ b/test/Transforms/GVN/2008-03-13-ReturnSlotBitcast.ll @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {call.*memcpy.} + %a = type { i32 } + %b = type { float } + +declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @g(%a*) + +define float @f() { +entry: + %a_var = alloca %a + %b_var = alloca %b + call void @g(%a *%a_var) + %a_i8 = bitcast %a* %a_var to i8* + %b_i8 = bitcast %b* %b_var to i8* + call void @llvm.memcpy.i32(i8* %b_i8, i8* %a_i8, i32 4, i32 4) + %tmp1 = getelementptr %b* %b_var, i32 0, i32 0 + %tmp2 = load float* %tmp1 + ret float %tmp2 +} |