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
61 lines
1.9 KiB
LLVM
61 lines
1.9 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; Verify that strnlen calls that aren't folded into constants are annotated
|
|
; with noundef, nonnull, and dereferenceable only when maxlen is known to
|
|
; to be nonzero.
|
|
;
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
|
|
declare i64 @strnlen(ptr, i64)
|
|
|
|
@ecp = external global ptr, align 8
|
|
|
|
|
|
; Annotate strnlen(ecp, 3) call with noundef, nonnull, and dereferenceable
|
|
; based on the access to *ecp.
|
|
|
|
define i64 @deref_strnlen_ecp_3() {
|
|
; CHECK-LABEL: @deref_strnlen_ecp_3(
|
|
; CHECK-NEXT: [[PTR:%.*]] = load ptr, ptr @ecp, align 8
|
|
; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(ptr noundef nonnull dereferenceable(1) [[PTR]], i64 3)
|
|
; CHECK-NEXT: ret i64 [[LEN]]
|
|
;
|
|
%ptr = load ptr, ptr @ecp
|
|
%len = call i64 @strnlen(ptr %ptr, i64 3)
|
|
ret i64 %len
|
|
}
|
|
|
|
|
|
; Annotate strnlen(ecp, %n) call with nonzero %n with noundef, nonnull, and
|
|
; dereferenceable based on the access to *ecp.
|
|
|
|
define i64 @deref_strnlen_ecp_nz(i64 %n) {
|
|
; CHECK-LABEL: @deref_strnlen_ecp_nz(
|
|
; CHECK-NEXT: [[NONZERO:%.*]] = or i64 [[N:%.*]], 1
|
|
; CHECK-NEXT: [[PTR:%.*]] = load ptr, ptr @ecp, align 8
|
|
; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(ptr noundef nonnull dereferenceable(1) [[PTR]], i64 [[NONZERO]])
|
|
; CHECK-NEXT: ret i64 [[LEN]]
|
|
;
|
|
%nonzero = or i64 %n, 1
|
|
%ptr = load ptr, ptr @ecp
|
|
%len = call i64 @strnlen(ptr %ptr, i64 %nonzero)
|
|
ret i64 %len
|
|
}
|
|
|
|
|
|
|
|
; Do not annotate strnlen(ecp, %n) call with nonnull etc. because it need
|
|
; not access *ecp. (Strictly, every pointer function argument must be
|
|
; noundef, so this is overly conservative.)
|
|
|
|
|
|
define i64 @noderef_strnlen_ecp_n(i64 %n) {
|
|
; CHECK-LABEL: @noderef_strnlen_ecp_n(
|
|
; CHECK-NEXT: [[PTR:%.*]] = load ptr, ptr @ecp, align 8
|
|
; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(ptr [[PTR]], i64 [[N:%.*]])
|
|
; CHECK-NEXT: ret i64 [[LEN]]
|
|
;
|
|
%ptr = load ptr, ptr @ecp
|
|
%len = call i64 @strnlen(ptr %ptr, i64 %n)
|
|
ret i64 %len
|
|
}
|