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

83 lines
2.2 KiB
C++

// RUN: %clang_cc1 < %s -triple i386-mingw32 -fms-extensions -emit-llvm -x c++ | FileCheck %s
// optnone wins over inlinehint.
// Test that both func1 and func2 are marked optnone and noinline.
// Definition with both optnone and inlinehint.
__attribute__((optnone))
inline int func1(int a) {
return a + a + a + a;
}
// CHECK: @_Z5func1i({{.*}}) [[OPTNONE:#[0-9]+]]
// optnone declaration, inlinehint definition.
__attribute__((optnone))
int func2(int a);
inline int func2(int a) {
return a + a + a + a;
}
// CHECK: @_Z5func2i({{.*}}) [[OPTNONE]]
// Keep alive the definitions of func1 and func2.
int foo() {
int val = func1(1);
return val + func2(2);
}
// optnone wins over minsize.
__attribute__((optnone))
int func3(int a);
__attribute__((minsize))
int func3(int a) {
return a + a + a + a;
}
// Same attribute set as everything else, therefore no 'minsize'.
// CHECK: @_Z5func3i({{.*}}) [[OPTNONE]]
// Verify that noreturn is compatible with optnone.
__attribute__((noreturn))
extern void exit_from_function();
__attribute__((noreturn)) __attribute((optnone))
extern void noreturn_function(int a) { exit_from_function(); }
// CHECK: @_Z17noreturn_functioni({{.*}}) [[NORETURN:#[0-9]+]]
// Verify that __declspec(noinline) is compatible with optnone.
__declspec(noinline) __attribute__((optnone))
void func4() { return; }
// CHECK: @_Z5func4v() [[OPTNONE]]
__declspec(noinline)
extern void func5();
__attribute__((optnone))
void func5() { return; }
// CHECK: @_Z5func5v() [[OPTNONE]]
// Verify also that optnone can be used on dllexport functions.
// Adding attribute optnone on a dllimport function has no effect.
__attribute__((dllimport))
__attribute__((optnone))
int imported_optnone_func(int a);
__attribute__((dllexport))
__attribute__((optnone))
int exported_optnone_func(int a) {
return imported_optnone_func(a); // use of imported func
}
// CHECK: @_Z21exported_optnone_funci({{.*}}) [[OPTNONE]]
// CHECK: declare dllimport {{.*}} @_Z21imported_optnone_funci({{.*}}) [[DLLIMPORT:#[0-9]+]]
// CHECK: attributes [[OPTNONE]] = { mustprogress noinline {{.*}} optnone
// CHECK: attributes [[NORETURN]] = { mustprogress noinline noreturn {{.*}} optnone
// CHECK: attributes [[DLLIMPORT]] =
// CHECK-NOT: optnone