Files
TheRock/compiler/amd-llvm/clang/test/CIR/CodeGen/link-bitcode-file.c
T
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

71 lines
2.7 KiB
C

// RUN: %clang_cc1 -O1 -triple x86_64-unknown-linux-gnu -fclangir -DBITCODE -emit-llvm-bc -o %t.bc %s
// RUN: %clang_cc1 -O1 -triple x86_64-unknown-linux-gnu -fclangir -DBITCODE2 -emit-llvm-bc -o %t-2.bc %s
// RUN: %clang_cc1 -O1 -triple x86_64-unknown-linux-gnu -fclangir -mlink-bitcode-file %t.bc \
// RUN: -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-BC %s
// RUN: %clang_cc1 -O1 -triple x86_64-unknown-linux-gnu -fclangir -mlink-builtin-bitcode %t.bc \
// RUN: -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-BUILTIN-BC %s
// RUN: %clang_cc1 -O1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm -o - \
// RUN: -mlink-bitcode-file %t.bc -mlink-bitcode-file %t-2.bc %s \
// RUN: | FileCheck -check-prefix=CHECK-BC -check-prefix=CHECK-BC2 %s
// RUN: not %clang_cc1 -O1 -triple x86_64-unknown-linux-gnu -fclangir \
// RUN: -mlink-bitcode-file no-such-file.bc -emit-llvm -o - %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-NO-FILE %s
//
// -mlink-builtin-bitcode propagates the host TU's default function-definition
// attributes onto linked-in functions. Linking at -O0 keeps f from being
// inlined into g so the propagated attribute group is observable.
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu skylake -fclangir \
// RUN: -mlink-builtin-bitcode %t.bc -emit-llvm -o - %s \
// RUN: | FileCheck -check-prefix=CHECK-PROPAGATE %s
//
// -mlink-bitcode-file does NOT propagate (PropagateAttrs=false).
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu skylake -fclangir \
// RUN: -mlink-bitcode-file %t.bc -emit-llvm -o - %s \
// RUN: | FileCheck -check-prefix=CHECK-NO-PROPAGATE %s
int f(void);
#ifdef BITCODE
extern int f2(void);
volatile int gvar = 7;
int f(void) {
f2();
return 42;
}
#elif defined(BITCODE2)
int f2(void) { return 43; }
#else
extern volatile int gvar;
// -mlink-bitcode-file leaves linked symbols with external linkage.
// CHECK-BC: @gvar = global i32 7
// -mlink-builtin-bitcode internalizes linked symbols not referenced as roots.
// CHECK-BUILTIN-BC: @gvar = internal global i32 7
// CHECK-BC-LABEL: define{{.*}} i32 @g
// CHECK-BC: ret i32 42
// CHECK-BUILTIN-BC-LABEL: define{{.*}} i32 @g
// CHECK-BUILTIN-BC: ret i32 42
int g(void) {
gvar = 1;
return f();
}
// CHECK-BC-LABEL: define{{.*}} i32 @f
// CHECK-BC2-LABEL: define{{.*}} i32 @f2
// CHECK-PROPAGATE: define internal{{.*}} i32 @f(){{[^#]*}}#[[F_ATTRS:[0-9]+]]
// CHECK-PROPAGATE: attributes #[[F_ATTRS]] = {{.*}}"target-cpu"="skylake"
// CHECK-NO-PROPAGATE: define{{.*}} i32 @f(){{[^#]*}}#[[F_ATTRS:[0-9]+]]
// CHECK-NO-PROPAGATE-NOT: attributes #[[F_ATTRS]] = {{.*}}"target-cpu"="skylake"
#endif
// CHECK-NO-FILE: fatal error: cannot open file 'no-such-file.bc'