Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

79 lines
3.8 KiB
C++

// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
template<class ...Ts> auto foo() {
int values[sizeof...(Ts) + 1] = {Ts::value... };
return sizeof...(Ts);
}
struct S1 {
static constexpr int value = 1;
};
struct S2 {
static constexpr int value = 2;
};
struct S3 {
static constexpr int value = 3;
};
void test() {
foo<>();
foo<S1, S2, S3>();
}
// CIR-DAG: cir.global "private" constant cir_private @__const._Z3fooIJ2S12S22S3EEDav.values = #cir.const_array<[#cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<0> : !s32i]> : !cir.array<!s32i x 4>
// LLVM-DAG: @__const._Z3fooIJ2S12S22S3EEDav.values = private constant [4 x i32] [i32 1, i32 2, i32 3, i32 0]
// OGCG-DAG: @__const._Z3fooIJ2S12S22S3EEDav.values = private {{.*}}constant [4 x i32] [i32 1, i32 2, i32 3, i32 0]
// CIR-DAG: cir.global "private" constant cir_private @__const._Z3fooIJEEDav.values = #cir.zero : !cir.array<!s32i x 1>
// LLVM-DAG: @__const._Z3fooIJEEDav.values = private constant [1 x i32] zeroinitializer
// CIR: cir.func {{.*}}@_Z3fooIJEEDav()
// CIR: %[[RETVAL:.*]] = cir.alloca !u64i, !cir.ptr<!u64i>, ["__retval"]
// CIR: %[[VAL_ARR:.*]] = cir.alloca !cir.array<!s32i x 1>, !cir.ptr<!cir.array<!s32i x 1>>, ["values", init]
// CIR: %[[GET_GLOB_VAL:.*]] = cir.get_global @__const._Z3fooIJEEDav.values : !cir.ptr<!cir.array<!s32i x 1>>
// CIR: cir.copy %[[GET_GLOB_VAL]] to %[[VAL_ARR]] : !cir.ptr<!cir.array<!s32i x 1>>
// CIR: %[[ZERO:.*]] = cir.const #cir.int<0> : !u64i
// CIR: cir.store %[[ZERO]], %[[RETVAL]] : !u64i, !cir.ptr<!u64i>
// CIR: %[[RET_LOAD:.*]] = cir.load %[[RETVAL]] : !cir.ptr<!u64i>, !u64i
// CIR: cir.return %[[RET_LOAD]] : !u64i
// LLVM: define {{.*}}i64 @_Z3fooIJEEDav()
// LLVM: %[[RETVAL:.*]] = alloca i64
// LLVM: %[[VAL_ARR:.*]] = alloca [1 x i32]
// LLVM: call void @llvm.memcpy.p0.p0.i64(ptr %[[VAL_ARR]], ptr{{.*}} @__const._Z3fooIJEEDav.values, i64 4, i1 false)
// LLVM: store i64 0, ptr %[[RETVAL]]
// LLVM: %[[RET_LOAD:.*]] = load i64, ptr %[[RETVAL]]
// LLVM: ret i64 %[[RET_LOAD]]
// OGCG: define {{.*}}i64 @_Z3fooIJEEDav()
// OGCG: %[[VALUES:.*]] = alloca [1 x i32]
// OGCG: call void @llvm.memset.p0.i64(ptr {{.*}}%[[VALUES]], i8 0, i64 4, i1 false)
// OGCG: ret i64 0
// CIR: cir.func {{.*}}@_Z3fooIJ2S12S22S3EEDav()
// CIR: %[[RETVAL:.*]] = cir.alloca !u64i, !cir.ptr<!u64i>, ["__retval"]
// CIR: %[[VAL_ARR:.*]] = cir.alloca !cir.array<!s32i x 4>, !cir.ptr<!cir.array<!s32i x 4>>, ["values", init]
// CIR: %[[GET_GLOB_VAL:.*]] = cir.get_global @__const._Z3fooIJ2S12S22S3EEDav.values : !cir.ptr<!cir.array<!s32i x 4>>
// CIR: cir.copy %[[GET_GLOB_VAL]] to %[[VAL_ARR]] : !cir.ptr<!cir.array<!s32i x 4>>
// CIR: %[[THREE:.*]] = cir.const #cir.int<3> : !u64i
// CIR: cir.store %[[THREE]], %[[RETVAL]] : !u64i, !cir.ptr<!u64i>
// CIR: %[[RET_LOAD:.*]] = cir.load %[[RETVAL]] : !cir.ptr<!u64i>, !u64i
// CIR: cir.return %[[RET_LOAD]] : !u64i
// LLVM: define {{.*}}i64 @_Z3fooIJ2S12S22S3EEDav()
// LLVM: %[[RETVAL:.*]] = alloca i64
// LLVM: %[[VAL_ARR:.*]] = alloca [4 x i32]
// LLVM: call void @llvm.memcpy.p0.p0.i64(ptr %[[VAL_ARR]], ptr{{.*}} @__const._Z3fooIJ2S12S22S3EEDav.values, i64 16, i1 false)
// LLVM: store i64 3, ptr %[[RETVAL]]
// LLVM: %[[RET_LOAD:.*]] = load i64, ptr %[[RETVAL]]
// LLVM: ret i64 %[[RET_LOAD]]
// OGCG: define {{.*}}i64 @_Z3fooIJ2S12S22S3EEDav()
// OGCG: %[[VALUES:.*]] = alloca [4 x i32]
// OGCG: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}%[[VALUES]], ptr {{.*}}@__const._Z3fooIJ2S12S22S3EEDav.values, i64 16, i1 false)
// OGCG: ret i64 3