xref: /llvm-project/clang/test/CodeGen/struct-copy.c (revision 29441e4f5fa5f5c7709f7cf180815ba97f611297)
1 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
2 struct x { int a[100]; };
3 
4 
5 void foo(struct x *P, struct x *Q) {
6 // CHECK-LABEL: @foo(
7 // CHECK:    call void @llvm.memcpy.p0.p0
8   *P = *Q;
9 }
10 
11 // CHECK: declare void @llvm.memcpy.p0.p0{{.*}}(ptr noalias writeonly captures(none), ptr noalias readonly
12 
13 void bar(struct x *P, struct x *Q) {
14 // CHECK-LABEL: @bar(
15 // CHECK:    call void @llvm.memcpy.p0.p0
16   __builtin_memcpy(P, Q, sizeof(struct x));
17 }
18