56 lines · c
1// RUN: %clang_cc1 -std=c23 -emit-llvm -triple x86_64 %s -o - | FileCheck %s2 3struct S {4 int arr[3];5};6 7struct S1 {8 struct S s;9};10 11// CHECK: @[[BConst:.*]] = private unnamed_addr constant [2 x i32] [i32 47, i32 47]12// CHECK: @[[DConst:.*]] = private unnamed_addr constant [2 x i8] c"//"13// CHECK: @[[SConst:.*]] = private unnamed_addr constant %struct.S { [3 x i32] [i32 47, i32 47, i32 32] }14// CHECK: @[[S1Const:.*]] = private unnamed_addr constant %struct.S1 { %struct.S { [3 x i32] [i32 47, i32 47, i32 32] } }15 16void cases(int x) {17 int a[3] = {x, x,18#embed __FILE__19 };20 21 int b[2] = {22#embed __FILE__23 };24 25 char d[2] = {26#embed __FILE__27 };28 29 struct S s = {30#embed __FILE__31 , x32 };33 34 struct S1 s1 = {35#embed __FILE__36 , x37 };38}39// CHECK: define dso_local void @cases(i32 noundef %[[X:.*]])40// CHECK: %[[A:.*]] = alloca [3 x i32]41// CHECK: %[[B:.*]] = alloca [2 x i32]42// CHECK: %[[D:.*]] = alloca [2 x i8]43// CHECK: %[[S:.*]] = alloca %struct.S44// CHECK: %[[S1:.*]] = alloca %struct.S145// CHECK: %[[LX:.*]] = load i32, ptr %[[X]].addr46// CHECK: store i32 %[[LX]], ptr %[[A]]47// CHECK: %[[GEP1:.*]] = getelementptr inbounds i32, ptr %[[A]], i64 148// CHECK: %[[LX1:.*]] = load i32, ptr %[[X]].addr49// CHECK: store i32 %1, ptr %arrayinit.element50// CHECK: %[[GEP1:.*]] = getelementptr inbounds i32, ptr %[[A]], i64 251// CHECK: store i32 47, ptr %[[GEP1]]52// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[B]], ptr align 4 @[[BConst]], i64 8, i1 false)53// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %[[D]], ptr align 1 @[[DConst]], i64 2, i1 false)54// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[S]], ptr align 4 @[[SConst]], i64 12, i1 false)55// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[S1]], ptr align 4 @[[S1Const]], i64 12, i1 false)56