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
53 lines
1.7 KiB
LLVM
53 lines
1.7 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
;
|
|
; Verify that the result of memrchr calls with past-the-end pointers used
|
|
; don't cause trouble and are optimally folded.
|
|
|
|
declare i32 @memcmp(ptr, ptr, i64)
|
|
|
|
|
|
@a5 = constant [5 x i8] c"12345";
|
|
|
|
|
|
; Fold memcmp(a5, a5 + 5, n) to 0 on the assumption that n is 0 otherwise
|
|
; the call would be undefined.
|
|
|
|
define i32 @fold_memcmp_a5_a5p5_n(i64 %n) {
|
|
; CHECK-LABEL: @fold_memcmp_a5_a5p5_n(
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
%pa5_p5 = getelementptr [5 x i8], ptr @a5, i32 0, i32 5
|
|
%cmp = call i32 @memcmp(ptr @a5, ptr %pa5_p5, i64 %n)
|
|
ret i32 %cmp
|
|
}
|
|
|
|
|
|
; Same as above but for memcmp(a5 + 5, a5 + 5, n).
|
|
|
|
define i32 @fold_memcmp_a5p5_a5p5_n(i64 %n) {
|
|
; CHECK-LABEL: @fold_memcmp_a5p5_a5p5_n(
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
%pa5_p5 = getelementptr [5 x i8], ptr @a5, i32 0, i32 5
|
|
%qa5_p5 = getelementptr [5 x i8], ptr @a5, i32 0, i32 5
|
|
%cmp = call i32 @memcmp(ptr %pa5_p5, ptr %qa5_p5, i64 %n)
|
|
ret i32 %cmp
|
|
}
|
|
|
|
|
|
; TODO: Likewise, fold memcmp(a5 + i, a5 + 5, n) to 0 on same basis.
|
|
|
|
define i32 @fold_memcmp_a5pi_a5p5_n(i32 %i, i64 %n) {
|
|
; CHECK-LABEL: @fold_memcmp_a5pi_a5p5_n(
|
|
; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I:%.*]] to i64
|
|
; CHECK-NEXT: [[PA5_PI:%.*]] = getelementptr i8, ptr @a5, i64 [[TMP1]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = call i32 @memcmp(ptr [[PA5_PI]], ptr nonnull getelementptr inbounds nuw (i8, ptr @a5, i64 5), i64 [[N:%.*]])
|
|
; CHECK-NEXT: ret i32 [[CMP]]
|
|
;
|
|
%pa5_pi = getelementptr [5 x i8], ptr @a5, i32 0, i32 %i
|
|
%pa5_p5 = getelementptr [5 x i8], ptr @a5, i32 0, i32 5
|
|
%cmp = call i32 @memcmp(ptr %pa5_pi, ptr %pa5_p5, i64 %n)
|
|
ret i32 %cmp
|
|
}
|