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
78 lines
3.3 KiB
LLVM
78 lines
3.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt -S -passes=loop-vectorize %s | FileCheck %s
|
|
|
|
; TODO: The loop should be vectorized. The vectorizer needs to prove
|
|
; (A umin B) u<= A to establish memory safety from the dereferenceable
|
|
; assumption.
|
|
;
|
|
; long n = umin(count, length);
|
|
; for (long i = 0; i < n; i++)
|
|
; if (ptr[i] == 0) return null;
|
|
; ...
|
|
define ptr @main(i32 %length, ptr %ptr, i64 %0) #0 {
|
|
; CHECK-LABEL: define ptr @main(
|
|
; CHECK-SAME: i32 [[LENGTH:%.*]], ptr [[PTR:%.*]], i64 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[NULL_CHECK0:%.*]] = icmp eq i64 [[TMP0]], 0
|
|
; CHECK-NEXT: br i1 [[NULL_CHECK0]], label %[[DEOPT:.*]], label %[[PREHEADER:.*]]
|
|
; CHECK: [[PREHEADER]]:
|
|
; CHECK-NEXT: [[LENGTH_64:%.*]] = zext i32 [[LENGTH]] to i64
|
|
; CHECK-NEXT: [[EXIT:%.*]] = call i64 @llvm.umin.i64(i64 [[TMP0]], i64 [[LENGTH_64]])
|
|
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[PTR]], i64 8), "dereferenceable"(ptr [[PTR]], i64 [[LENGTH_64]]) ]
|
|
; CHECK-NEXT: [[NULL_CHECK:%.*]] = icmp eq i32 [[LENGTH]], 0
|
|
; CHECK-NEXT: br i1 [[NULL_CHECK]], label %[[DEOPT]], label %[[SCALAR_PH:.*]]
|
|
; CHECK: [[SCALAR_PH]]:
|
|
; CHECK-NEXT: br label %[[LOOP:.*]]
|
|
; CHECK: [[LOOP]]:
|
|
; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], %[[LATCH:.*]] ], [ 0, %[[SCALAR_PH]] ]
|
|
; CHECK-NEXT: [[ELEMENT_GEP:%.*]] = getelementptr i8, ptr [[PTR]], i64 [[IV]]
|
|
; CHECK-NEXT: [[ELEMENT:%.*]] = load i8, ptr [[ELEMENT_GEP]], align 1
|
|
; CHECK-NEXT: [[FOUND_CHECK:%.*]] = icmp eq i8 [[ELEMENT]], 0
|
|
; CHECK-NEXT: br i1 [[FOUND_CHECK]], label %[[FOUND:.*]], label %[[LATCH]]
|
|
; CHECK: [[LATCH]]:
|
|
; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1
|
|
; CHECK-NEXT: [[RANGE_CHECK:%.*]] = icmp ult i64 [[IV_NEXT]], [[EXIT]]
|
|
; CHECK-NEXT: br i1 [[RANGE_CHECK]], label %[[LOOP]], label %[[DEOPT_LOOPEXIT:.*]]
|
|
; CHECK: [[FOUND]]:
|
|
; CHECK-NEXT: ret ptr null
|
|
; CHECK: [[DEOPT_LOOPEXIT]]:
|
|
; CHECK-NEXT: br label %[[DEOPT]]
|
|
; CHECK: [[DEOPT]]:
|
|
; CHECK-NEXT: unreachable
|
|
;
|
|
entry:
|
|
%null_check0 = icmp eq i64 %0, 0
|
|
br i1 %null_check0, label %deopt, label %preheader
|
|
|
|
preheader: ; preds = %entry
|
|
%length.64 = zext i32 %length to i64
|
|
%exit = call i64 @llvm.umin.i64(i64 %0, i64 %length.64)
|
|
call void @llvm.assume(i1 true) [ "align"(ptr %ptr, i64 8), "dereferenceable"(ptr %ptr, i64 %length.64) ]
|
|
%null_check = icmp eq i32 %length, 0
|
|
br i1 %null_check, label %deopt, label %loop
|
|
|
|
loop: ; preds = %latch, %preheader
|
|
%iv = phi i64 [ %iv.next, %latch ], [ 0, %preheader ]
|
|
%element_gep = getelementptr i8, ptr %ptr, i64 %iv
|
|
%element = load i8, ptr %element_gep, align 1
|
|
%found_check = icmp eq i8 %element, 0
|
|
br i1 %found_check, label %found, label %latch
|
|
|
|
latch: ; preds = %loop
|
|
%iv.next = add i64 %iv, 1
|
|
%range_check = icmp ult i64 %iv.next, %exit
|
|
br i1 %range_check, label %loop, label %deopt
|
|
|
|
found: ; preds = %loop
|
|
ret ptr null
|
|
|
|
deopt: ; preds = %latch, %preheader
|
|
unreachable
|
|
}
|
|
|
|
declare i64 @llvm.umin.i64(i64, i64)
|
|
|
|
declare void @llvm.assume(i1 noundef)
|
|
|
|
attributes #0 = { nofree nosync }
|