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
72 lines
2.2 KiB
LLVM
72 lines
2.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
|
|
|
|
define i64 @ptrdiff(ptr %ptr) {
|
|
; CHECK-LABEL: @ptrdiff(
|
|
; CHECK-NEXT: ret i64 42
|
|
;
|
|
%last = getelementptr inbounds i8, ptr %ptr, i32 42
|
|
%first.int = ptrtoint ptr %ptr to i64
|
|
%last.int = ptrtoint ptr %last to i64
|
|
%diff = sub i64 %last.int, %first.int
|
|
ret i64 %diff
|
|
}
|
|
|
|
define i64 @ptrdiff_no_inbounds(ptr %ptr) {
|
|
; CHECK-LABEL: @ptrdiff_no_inbounds(
|
|
; CHECK-NEXT: ret i64 42
|
|
;
|
|
%last = getelementptr i8, ptr %ptr, i32 42
|
|
%first.int = ptrtoint ptr %ptr to i64
|
|
%last.int = ptrtoint ptr %last to i64
|
|
%diff = sub i64 %last.int, %first.int
|
|
ret i64 %diff
|
|
}
|
|
|
|
define i64 @ptrdiff_chain(ptr %ptr) {
|
|
; CHECK-LABEL: @ptrdiff_chain(
|
|
; CHECK-NEXT: ret i64 42
|
|
;
|
|
%first2 = getelementptr inbounds i8, ptr %ptr, i32 1
|
|
%first3 = getelementptr inbounds i8, ptr %first2, i32 2
|
|
%first4 = getelementptr inbounds i8, ptr %first3, i32 4
|
|
%last1 = getelementptr inbounds i8, ptr %first2, i32 48
|
|
%last2 = getelementptr inbounds i8, ptr %last1, i32 8
|
|
%last3 = getelementptr inbounds i8, ptr %last2, i32 -4
|
|
%last4 = getelementptr inbounds i8, ptr %last3, i32 -4
|
|
%first.int = ptrtoint ptr %first4 to i64
|
|
%last.int = ptrtoint ptr %last4 to i64
|
|
%diff = sub i64 %last.int, %first.int
|
|
ret i64 %diff
|
|
}
|
|
|
|
; Handle simple cases of vectors of pointers.
|
|
define <4 x i32> @ptrdiff_vectors(<4 x ptr> %arg) nounwind {
|
|
; CHECK-LABEL: @ptrdiff_vectors(
|
|
; CHECK-NEXT: ret <4 x i32> zeroinitializer
|
|
;
|
|
%p1 = ptrtoint <4 x ptr> %arg to <4 x i32>
|
|
%bc = bitcast <4 x ptr> %arg to <4 x ptr>
|
|
%p2 = ptrtoint <4 x ptr> %bc to <4 x i32>
|
|
%sub = sub <4 x i32> %p1, %p2
|
|
ret <4 x i32> %sub
|
|
}
|
|
|
|
%struct.ham = type { i32, [2 x [2 x i32]] }
|
|
|
|
@global = internal global %struct.ham zeroinitializer, align 4
|
|
|
|
define i32 @ptrdiff_global() nounwind {
|
|
; CHECK-LABEL: @ptrdiff_global(
|
|
; CHECK-NEXT: bb:
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
bb:
|
|
%tmp = getelementptr inbounds %struct.ham, ptr @global, i32 0, i32 1
|
|
%tmp3 = ptrtoint ptr %tmp to i32
|
|
%tmp4 = getelementptr inbounds %struct.ham, ptr @global, i32 0, i32 1
|
|
%tmp6 = ptrtoint ptr %tmp4 to i32
|
|
%tmp7 = sub i32 %tmp3, %tmp6
|
|
ret i32 %tmp7
|
|
}
|