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
47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
|
|
// RUN: %clang_cc1 -triple i386-mingw32 -fms-extensions -emit-llvm -o - %s | FileCheck %s
|
|
|
|
int nonconst(void);
|
|
int isconst(void) __attribute__((const));
|
|
int ispure(void) __attribute__((pure));
|
|
|
|
// CHECK-LABEL: @test1
|
|
int test1(int *a, int i) {
|
|
// CHECK: store ptr %a, ptr [[A_ADDR:%.+]], align
|
|
// CHECK: [[A:%.+]] = load ptr, ptr [[A_ADDR]]
|
|
// CHECK: [[CMP:%.+]] = icmp ne ptr [[A]], null
|
|
// CHECK: call void @llvm.assume(i1 [[CMP]])
|
|
|
|
// CHECK: [[CALL:%.+]] = call i32 @isconst()
|
|
// CHECK: [[BOOL:%.+]] = icmp ne i32 [[CALL]], 0
|
|
// CHECK: call void @llvm.assume(i1 [[BOOL]])
|
|
|
|
// CHECK: [[CALLPURE:%.+]] = call i32 @ispure()
|
|
// CHECK: [[BOOLPURE:%.+]] = icmp ne i32 [[CALLPURE]], 0
|
|
// CHECK: call void @llvm.assume(i1 [[BOOLPURE]])
|
|
#ifdef _MSC_VER
|
|
__assume(a != 0)
|
|
__assume(isconst());
|
|
__assume(ispure());
|
|
#else
|
|
__builtin_assume(a != 0);
|
|
__builtin_assume(isconst());
|
|
__builtin_assume(ispure());
|
|
#endif
|
|
|
|
// Nothing is generated for an assume with side effects...
|
|
// CHECK-NOT: load ptr, ptr %i.addr
|
|
// CHECK-NOT: call void @llvm.assume
|
|
// CHECK-NOT: call i32 @nonconst()
|
|
#ifdef _MSC_VER
|
|
__assume(++i != 0)
|
|
__assume(nonconst());
|
|
#else
|
|
__builtin_assume(++i != 0);
|
|
__builtin_assume(nonconst());
|
|
#endif
|
|
|
|
return a[0];
|
|
}
|
|
|