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
92 lines
3.0 KiB
C
92 lines
3.0 KiB
C
// RUN: %clang_cc1 -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 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm -disable-llvm-passes %s -o %t-cir.ll
|
|
// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-llvm-passes %s -o %t.ll
|
|
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
|
|
|
|
typedef unsigned long size_t;
|
|
|
|
// Normal inline builtin declaration
|
|
// When a builtin is redefined with extern inline + always_inline attributes,
|
|
// the compiler creates a .inline version to avoid conflicts with the builtin
|
|
|
|
extern inline __attribute__((always_inline)) __attribute__((gnu_inline))
|
|
void *memcpy(void *a, const void *b, size_t c) {
|
|
return __builtin_memcpy(a, b, c);
|
|
}
|
|
|
|
void *test_inline_builtin_memcpy(void *a, const void *b, size_t c) {
|
|
return memcpy(a, b, c);
|
|
}
|
|
|
|
// CIR: cir.func always_inline internal private{{.*}}@memcpy.inline({{.*}}) -> !cir.ptr<!void>
|
|
|
|
// CIR-LABEL: @test_inline_builtin_memcpy(
|
|
// CIR: cir.call @memcpy.inline(
|
|
// CIR: }
|
|
|
|
// LLVM: define internal ptr @memcpy.inline(ptr{{.*}}, ptr{{.*}}, i64{{.*}}) #{{[0-9]+}}
|
|
|
|
// LLVM-LABEL: @test_inline_builtin_memcpy(
|
|
// LLVM: call ptr @memcpy.inline(
|
|
|
|
// OGCG-LABEL: @test_inline_builtin_memcpy(
|
|
// OGCG: call ptr @memcpy.inline(
|
|
|
|
// OGCG: define internal ptr @memcpy.inline(ptr{{.*}} %a, ptr{{.*}} %b, i64{{.*}} %c) #{{[0-9]+}}
|
|
|
|
// Shadowing case
|
|
// When a non-inline function definition shadows an inline builtin declaration,
|
|
// the .inline version should be replaced with the regular function and removed.
|
|
|
|
extern inline __attribute__((always_inline)) __attribute__((gnu_inline))
|
|
void *memmove(void *a, const void *b, size_t c) {
|
|
return __builtin_memmove(a, b, c);
|
|
}
|
|
|
|
void *memmove(void *a, const void *b, size_t c) {
|
|
char *dst = (char *)a;
|
|
const char *src = (const char *)b;
|
|
if (dst < src) {
|
|
for (size_t i = 0; i < c; i++) {
|
|
dst[i] = src[i];
|
|
}
|
|
} else {
|
|
for (size_t i = c; i > 0; i--) {
|
|
dst[i-1] = src[i-1];
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
void *test_shadowed_memmove(void *a, const void *b, size_t c) {
|
|
return memmove(a, b, c);
|
|
}
|
|
|
|
// CIR: cir.func{{.*}}@memmove({{.*}}) -> !cir.ptr<!void>{{.*}}{
|
|
// CIR-NOT: @memmove.inline
|
|
|
|
// CIR-LABEL: @test_shadowed_memmove(
|
|
// CIR: cir.call @memmove(
|
|
// CIR-NOT: @memmove.inline
|
|
// CIR: }
|
|
|
|
// LLVM: define dso_local ptr @memmove(ptr{{.*}}, ptr{{.*}}, i64{{.*}}) #{{[0-9]+}}
|
|
// LLVM-NOT: @memmove.inline
|
|
|
|
// LLVM-LABEL: @test_shadowed_memmove(
|
|
// TODO - this deviation from OGCG is expected until we implement the nobuiltin
|
|
// attribute. See CIRGenFunction::emitDirectCallee
|
|
// LLVM: call ptr @memmove(
|
|
// LLVM-NOT: @memmove.inline
|
|
// LLVM: }
|
|
|
|
// OGCG: define dso_local ptr @memmove(ptr{{.*}} %a, ptr{{.*}} %b, i64{{.*}} %c) #{{[0-9]+}}
|
|
// OGCG-NOT: @memmove.inline
|
|
|
|
// OGCG-LABEL: @test_shadowed_memmove(
|
|
// OGCG: call void @llvm.memmove.p0.p0.i64(
|
|
// OGCG-NOT: @memmove.inline
|
|
// OGCG: }
|