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 | 8a97fddbc2c064e295ad5fb6269795bd904e1ed2 (patch) | |
tree | 905cd8e0354587610a352135dad5972c6703193f /test/Transforms/GVN | |
parent | 200d607b45e48f9660985b60ff7c5382f1677368 (diff) | |
download | llvm-8a97fddbc2c064e295ad5fb6269795bd904e1ed2.tar.gz llvm-8a97fddbc2c064e295ad5fb6269795bd904e1ed2.tar.bz2 llvm-8a97fddbc2c064e295ad5fb6269795bd904e1ed2.tar.xz |
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/GVN')
-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 0000000000..7757a92b24 --- /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 +} |