llvm-project
32 строки · 1.8 Кб
1// RUN: %clang_cc1 -x c++ -std=c++20 -triple x86_64-unknown-linux-gnu -emit-pch -o %t %S/cxx_paren_init.h
2// RUN: %clang_cc1 -x c++ -std=c++20 -triple x86_64-unknown-linux-gnu -include-pch %t %s -emit-llvm -o - | FileCheck %s
3
4// CHECK-DAG: [[STRUCT_S:%.*]] = type { i32, i32 }
5// CHECK-DAG: @{{.*s.*}} = {{(dso_local )?}}global [[STRUCT_S]] { i32 1, i32 2 }, align 4
6S s = foo(1, 2);
7
8// CHECK-DAG: [[UNION_U:%.*]] = type { i32 }
9// CHECK-DAG: @{{.*u.*}} = {{(dso_local )?}}global [[UNION_U]] { i32 3 }, align 4
10U u = baz(3);
11
12// CHECK: define dso_local void @{{.*bar.*}}
13// CHECK-NEXT: entry:
14// CHECK-NEXT: [[I_ADDR:%.*]] = alloca i32, align 4
15// CHECK-NEXT: [[J_ADDR:%.*]] = alloca i32, align 4
16// CHECK-NEXT: [[ARR:%.*]] = alloca [4 x i32], align 16
17// CHECK-NEXT: store i32 [[A:%.*]], ptr [[I_ADDR]], align 4
18// CHECK-NEXT: store i32 [[B:%.*]], ptr [[J_ADDR]], align 4
19// CHECK-NEXT: [[TMP_0:%.*]] = load i32, ptr [[I_ADDR]], align 4
20// CHECK-NEXT: store i32 [[TMP_0]], ptr [[ARR]], align 4
21// CHECK-NEXT: [[ARRINIT_ELEM:%.*]] = getelementptr inbounds i32, ptr [[ARR]], i64 1
22// CHECK-NEXT: [[TMP_1:%.*]] = load i32, ptr [[J_ADDR]], align 4
23// CHECK-NEXT: store i32 [[TMP_1]], ptr [[ARRINIT_ELEM]], align 4
24// CHECK-NEXT: [[ARRINIT_START:%.*]] = getelementptr inbounds i32, ptr [[ARR]], i64 2
25// CHECK-NEXT: [[ARRINIT_END:%.*]] = getelementptr inbounds i32, ptr [[ARR]], i64 4
26// CHECK-NEXT: br label [[ARRINIT_BODY:%.*]]
27// CHECK: [[ARRINIT_CUR:%.*]] = phi ptr [ [[ARRINIT_START]], %entry ], [ [[ARRINIT_NEXT:%.*]], [[ARRINIT_BODY]] ]
28// CHECK-NEXT: store i32 0, ptr [[ARRINIT_CUR]], align 4
29// CHECK-NEXT: [[ARRINIT_NEXT]] = getelementptr inbounds i32, ptr [[ARRINIT_CUR]], i64 1
30// CHECK-NEXT: [[ARRINIT_DONE:%.*]] = icmp eq ptr [[ARRINIT_NEXT]], [[ARRINIT_END:%.*]]
31// CHECK-NEXT: br i1 [[ARRINIT_DONE]], label [[ARRINIT_END1:%.*]], label [[ARRINIT_BODY]]
32// CHECK: ret void
33