Debian Codegraph @

clang/test/CodeGen/excess-embed-data.c

raw
1 // RUN: %clang_cc1 -std=c23 -emit-llvm -triple x86_64 %s -o - | FileCheck %s
2
3 struct S {
4 int arr[3];
5 };
6
7 struct 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
16 void 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 , x
32 };
33
34 struct S1 s1 = {
35 #embed __FILE__
36 , x
37 };
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.S
44 // CHECK: %[[S1:.*]] = alloca %struct.S1
45 // CHECK: %[[LX:.*]] = load i32, ptr %[[X]].addr
46 // CHECK: store i32 %[[LX]], ptr %[[A]]
47 // CHECK: %[[GEP1:.*]] = getelementptr inbounds i32, ptr %[[A]], i64 1
48 // CHECK: %[[LX1:.*]] = load i32, ptr %[[X]].addr
49 // CHECK: store i32 %1, ptr %arrayinit.element
50 // CHECK: %[[GEP1:.*]] = getelementptr inbounds i32, ptr %[[A]], i64 2
51 // 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)