blob: d702f3ff852adb7bed5733eb178fa544db634c0e [file] [log] [blame]
Nick Lewyckyfc243d52014-09-01 06:03:11 +00001; RUN: opt -basicaa -memcpyopt -instcombine -S < %s | FileCheck %s
2
3target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6define void @foo([8 x i64]* noalias nocapture sret dereferenceable(64)) {
7entry-block:
8 %a = alloca [8 x i64], align 8
9 %1 = bitcast [8 x i64]* %a to i8*
10 call void @llvm.lifetime.start(i64 64, i8* %1)
11 call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 64, i32 8, i1 false)
12 %2 = bitcast [8 x i64]* %0 to i8*
13 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %1, i64 64, i32 8, i1 false)
14 call void @llvm.lifetime.end(i64 64, i8* %1)
15 ret void
16
17; CHECK-LABEL: @foo(
18; CHECK: %1 = bitcast
19; CHECK: call void @llvm.memset
20; CHECK-NOT: call void @llvm.memcpy
21; CHECK: ret void
22}
23
24declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind
25declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
26
27declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) nounwind
28declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind