[PATCH] D66173: [Codegen] Updated test for D66158

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 14:41:45 PDT 2019


xbolva00 created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D66173

Files:
  test/CodeGen/struct-copy.c


Index: test/CodeGen/struct-copy.c
===================================================================
--- test/CodeGen/struct-copy.c
+++ test/CodeGen/struct-copy.c
@@ -1,7 +1,21 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | grep 'call.*llvm.memcpy'
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
 struct x { int a[100]; };
 
-
 void foo(struct x *P, struct x *Q) {
+// CHECK-LABEL: @foo(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[P_ADDR:%.*]] = alloca %struct.x*, align 8
+// CHECK-NEXT:    [[Q_ADDR:%.*]] = alloca %struct.x*, align 8
+// CHECK-NEXT:    store %struct.x* [[P:%.*]], %struct.x** [[P_ADDR]], align 8
+// CHECK-NEXT:    store %struct.x* [[Q:%.*]], %struct.x** [[Q_ADDR]], align 8
+// CHECK-NEXT:    [[TMP0:%.*]] = load %struct.x*, %struct.x** [[P_ADDR]], align 8
+// CHECK-NEXT:    [[TMP1:%.*]] = load %struct.x*, %struct.x** [[Q_ADDR]], align 8
+// CHECK-NEXT:    [[TMP2:%.*]] = bitcast %struct.x* [[TMP0]] to i8*
+// CHECK-NEXT:    [[TMP3:%.*]] = bitcast %struct.x* [[TMP1]] to i8*
+// CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[TMP2]], i8* align 4 [[TMP3]], i64 400, i1 false)
+// CHECK-NEXT:    ret void
+//
   *P = *Q;
 }
+
+// CHECK: declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66173.214926.patch
Type: text/x-patch
Size: 1305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190813/2d65a719/attachment.bin>


More information about the cfe-commits mailing list