diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-04-10 19:00:25 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-04-10 19:00:25 +0000 |
| commit | daa08875b31a20d8e1b429de42ad4d2e53480775 (patch) | |
| tree | fd421db37ca7df8e98cff168423cb00be52ec8ce /llvm/test/Transforms/MemCpyOpt | |
| parent | 74603a68efb57f36fccb32caac1313ee39421da6 (diff) | |
| download | bcm5719-llvm-daa08875b31a20d8e1b429de42ad4d2e53480775.tar.gz bcm5719-llvm-daa08875b31a20d8e1b429de42ad4d2e53480775.zip | |
[MemCpyOpt] Only replace memcpy with bitcast if address spaces match
Patch by James Price
llvm-svn: 299866
Diffstat (limited to 'llvm/test/Transforms/MemCpyOpt')
| -rw-r--r-- | llvm/test/Transforms/MemCpyOpt/memcpy.ll | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy.ll b/llvm/test/Transforms/MemCpyOpt/memcpy.ll index f638d8d5701..e4d50f7157d 100644 --- a/llvm/test/Transforms/MemCpyOpt/memcpy.ll +++ b/llvm/test/Transforms/MemCpyOpt/memcpy.ll @@ -76,8 +76,21 @@ define void @test4(i8 *%P) { ; CHECK-NEXT: call void @test4a( } +; Make sure we don't remove the memcpy if the source address space doesn't match the byval argument +define void @test4_addrspace(i8 addrspace(1)* %P) { + %A = alloca %1 + %a = bitcast %1* %A to i8* + call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* %P, i64 8, i32 4, i1 false) + call void @test4a(i8* align 1 byval %a) + ret void +; CHECK-LABEL: @test4_addrspace( +; CHECK: call void @llvm.memcpy.p0i8.p1i8.i64( +; CHECK-NEXT: call void @test4a( +} + declare void @test4a(i8* align 1 byval) declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind +declare void @llvm.memcpy.p0i8.p1i8.i64(i8* nocapture, i8 addrspace(1)* nocapture, i64, i32, i1) nounwind declare void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* nocapture, i8 addrspace(1)* nocapture, i64, i32, i1) nounwind %struct.S = type { i128, [4 x i8]} |

