blob: 77b495f2b583994c6ac9feb16d8efc99a9fdfba1 [file] [log] [blame]
Tim Shen7aa0ad62016-06-08 19:42:32 +00001; RUN: opt < %s -O1 -S | FileCheck %s
2
3; performCallSlotOptzn in MemCpy should not exchange the calls to
4; @llvm.lifetime.start and @llvm.memcpy.
5
6declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1
Matt Arsenaultf10061e2017-04-10 20:18:21 +00007declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
8declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
Tim Shen7aa0ad62016-06-08 19:42:32 +00009
10define void @_ZN4CordC2EOS_(i8* nocapture dereferenceable(16) %arg1) {
11bb:
12; CHECK-LABEL: @_ZN4CordC2EOS_
13; CHECK-NOT: call void @llvm.lifetime.start
14; CHECK: ret void
15 %tmp = alloca [8 x i8], align 8
16 %tmp5 = bitcast [8 x i8]* %tmp to i8*
Matt Arsenaultf10061e2017-04-10 20:18:21 +000017 call void @llvm.lifetime.start.p0i8(i64 16, i8* %tmp5)
Tim Shen7aa0ad62016-06-08 19:42:32 +000018 %tmp10 = getelementptr inbounds i8, i8* %tmp5, i64 7
19 store i8 0, i8* %tmp10, align 1
20 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %arg1, i8* %tmp5, i64 16, i32 8, i1 false)
Matt Arsenaultf10061e2017-04-10 20:18:21 +000021 call void @llvm.lifetime.end.p0i8(i64 16, i8* %tmp5)
Tim Shen7aa0ad62016-06-08 19:42:32 +000022 ret void
23}
24
25attributes #1 = { argmemonly nounwind }