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
146 lines
7.0 KiB
LLVM
146 lines
7.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -S -passes=instsimplify < %s | FileCheck %s
|
|
;; Check that we do not create new inttoptr instructions for unstable pointers
|
|
;; or pointers with external state (even if the values are all constants).
|
|
;; NOTE: for all but the zero address space, the GEP should only modify the
|
|
;; low 8 bits of the pointer.
|
|
target datalayout = "p:16:16:16:16-p1:16:16:16:8-pu2:16:16:16:8-pe3:16:16:16:8"
|
|
|
|
define ptr @test_null_base_normal() {
|
|
; CHECK-LABEL: define ptr @test_null_base_normal() {
|
|
; CHECK-NEXT: ret ptr inttoptr (i16 -2 to ptr)
|
|
;
|
|
%gep = getelementptr i8, ptr null, i8 -2
|
|
ret ptr %gep
|
|
}
|
|
define ptr @test_inttoptr_base_normal() {
|
|
; CHECK-LABEL: define ptr @test_inttoptr_base_normal() {
|
|
; CHECK-NEXT: ret ptr null
|
|
;
|
|
%base = inttoptr i16 -1 to ptr
|
|
%gep = getelementptr i8, ptr %base, i8 1
|
|
ret ptr %gep
|
|
}
|
|
|
|
;; Transformation is fine for non-integral address space, but we can only change
|
|
;; the index bits: (i8 -2 == i16 254)
|
|
define ptr addrspace(1) @test_null_base_nonintegral() {
|
|
; CHECK-LABEL: define ptr addrspace(1) @test_null_base_nonintegral() {
|
|
; CHECK-NEXT: ret ptr addrspace(1) inttoptr (i16 254 to ptr addrspace(1))
|
|
;
|
|
%gep = getelementptr i8, ptr addrspace(1) null, i8 -2
|
|
ret ptr addrspace(1) %gep
|
|
}
|
|
define ptr addrspace(1) @test_inttoptr_base_nonintegral() {
|
|
; CHECK-LABEL: define ptr addrspace(1) @test_inttoptr_base_nonintegral() {
|
|
; CHECK-NEXT: ret ptr addrspace(1) inttoptr (i16 -256 to ptr addrspace(1))
|
|
;
|
|
%base = inttoptr i16 -1 to ptr addrspace(1)
|
|
%gep = getelementptr i8, ptr addrspace(1) %base, i8 1
|
|
ret ptr addrspace(1) %gep
|
|
}
|
|
|
|
;; For unstable pointers we should avoid any introduction of inttoptr
|
|
define ptr addrspace(2) @test_null_base_unstable() {
|
|
; CHECK-LABEL: define ptr addrspace(2) @test_null_base_unstable() {
|
|
; CHECK-NEXT: ret ptr addrspace(2) getelementptr (i8, ptr addrspace(2) null, i8 -2)
|
|
;
|
|
%gep = getelementptr i8, ptr addrspace(2) null, i8 -2
|
|
ret ptr addrspace(2) %gep
|
|
}
|
|
define ptr addrspace(2) @test_inttoptr_base_unstable() {
|
|
; CHECK-LABEL: define ptr addrspace(2) @test_inttoptr_base_unstable() {
|
|
; CHECK-NEXT: ret ptr addrspace(2) getelementptr (i8, ptr addrspace(2) inttoptr (i16 -1 to ptr addrspace(2)), i8 1)
|
|
;
|
|
%base = inttoptr i16 -1 to ptr addrspace(2)
|
|
%gep = getelementptr i8, ptr addrspace(2) %base, i8 1
|
|
ret ptr addrspace(2) %gep
|
|
}
|
|
|
|
;; The same is true for pointers with external state: no new inttoptr
|
|
define ptr addrspace(3) @test_null_base_external() {
|
|
; CHECK-LABEL: define ptr addrspace(3) @test_null_base_external() {
|
|
; CHECK-NEXT: ret ptr addrspace(3) getelementptr (i8, ptr addrspace(3) null, i8 -2)
|
|
;
|
|
%gep = getelementptr i8, ptr addrspace(3) null, i8 -2
|
|
ret ptr addrspace(3) %gep
|
|
}
|
|
|
|
define ptr addrspace(3) @test_inttoptr_base_external() {
|
|
; CHECK-LABEL: define ptr addrspace(3) @test_inttoptr_base_external() {
|
|
; CHECK-NEXT: ret ptr addrspace(3) getelementptr (i8, ptr addrspace(3) inttoptr (i16 -1 to ptr addrspace(3)), i8 1)
|
|
;
|
|
%base = inttoptr i16 -1 to ptr addrspace(3)
|
|
%gep = getelementptr i8, ptr addrspace(3) %base, i8 1
|
|
ret ptr addrspace(3) %gep
|
|
}
|
|
|
|
define <2 x ptr> @test_vec_null_base_normal() {
|
|
; CHECK-LABEL: define <2 x ptr> @test_vec_null_base_normal() {
|
|
; CHECK-NEXT: ret <2 x ptr> getelementptr (i8, <2 x ptr> splat (ptr null), <2 x i16> <i16 -2, i16 -3>)
|
|
;
|
|
%gep = getelementptr i8, <2 x ptr> <ptr null, ptr null>, <2 x i8> <i8 -2, i8 -3>
|
|
ret <2 x ptr> %gep
|
|
}
|
|
define <2 x ptr> @test_vec_inttoptr_base_normal() {
|
|
; CHECK-LABEL: define <2 x ptr> @test_vec_inttoptr_base_normal() {
|
|
; CHECK-NEXT: ret <2 x ptr> getelementptr (i8, <2 x ptr> <ptr inttoptr (i16 -1 to ptr), ptr inttoptr (i16 -2 to ptr)>, <2 x i16> <i16 1, i16 2>)
|
|
;
|
|
%base = inttoptr <2 x i16> <i16 -1, i16 -2> to <2 x ptr>
|
|
%gep = getelementptr i8, <2 x ptr> %base, <2 x i8> <i8 1, i8 2>
|
|
ret <2 x ptr> %gep
|
|
}
|
|
|
|
;; Transformation is fine for non-integral address space, but we can only change
|
|
;; the index bits: (i8 -2 == i16 254)
|
|
define <2 x ptr addrspace(1)> @test_vec_null_base_nonintegral() {
|
|
; CHECK-LABEL: define <2 x ptr addrspace(1)> @test_vec_null_base_nonintegral() {
|
|
; CHECK-NEXT: ret <2 x ptr addrspace(1)> getelementptr (i8, <2 x ptr addrspace(1)> splat (ptr addrspace(1) null), <2 x i8> <i8 -2, i8 -3>)
|
|
;
|
|
%gep = getelementptr i8, <2 x ptr addrspace(1)> <ptr addrspace(1) null, ptr addrspace(1) null>, <2 x i8> <i8 -2, i8 -3>
|
|
ret <2 x ptr addrspace(1)> %gep
|
|
}
|
|
define <2 x ptr addrspace(1)> @test_vec_inttoptr_base_nonintegral() {
|
|
; CHECK-LABEL: define <2 x ptr addrspace(1)> @test_vec_inttoptr_base_nonintegral() {
|
|
; CHECK-NEXT: ret <2 x ptr addrspace(1)> getelementptr (i8, <2 x ptr addrspace(1)> <ptr addrspace(1) inttoptr (i16 -1 to ptr addrspace(1)), ptr addrspace(1) inttoptr (i16 -2 to ptr addrspace(1))>, <2 x i8> <i8 1, i8 2>)
|
|
;
|
|
%base = inttoptr <2 x i16> <i16 -1, i16 -2> to <2 x ptr addrspace(1)>
|
|
%gep = getelementptr i8, <2 x ptr addrspace(1)> %base, <2 x i8> <i8 1, i8 2>
|
|
ret <2 x ptr addrspace(1)> %gep
|
|
}
|
|
|
|
;; For unstable pointers we should avoid any introduction of inttoptr
|
|
define <2 x ptr addrspace(2)> @test_vec_null_base_unstable() {
|
|
; CHECK-LABEL: define <2 x ptr addrspace(2)> @test_vec_null_base_unstable() {
|
|
; CHECK-NEXT: ret <2 x ptr addrspace(2)> getelementptr (i8, <2 x ptr addrspace(2)> splat (ptr addrspace(2) null), <2 x i8> <i8 -2, i8 -3>)
|
|
;
|
|
%gep = getelementptr i8, <2 x ptr addrspace(2)> <ptr addrspace(2) null, ptr addrspace(2) null>, <2 x i8> <i8 -2, i8 -3>
|
|
ret <2 x ptr addrspace(2)> %gep
|
|
}
|
|
define <2 x ptr addrspace(2)> @test_vec_inttoptr_base_unstable() {
|
|
; CHECK-LABEL: define <2 x ptr addrspace(2)> @test_vec_inttoptr_base_unstable() {
|
|
; CHECK-NEXT: ret <2 x ptr addrspace(2)> getelementptr (i8, <2 x ptr addrspace(2)> <ptr addrspace(2) inttoptr (i16 -1 to ptr addrspace(2)), ptr addrspace(2) inttoptr (i16 -2 to ptr addrspace(2))>, <2 x i8> <i8 1, i8 2>)
|
|
;
|
|
%base = inttoptr <2 x i16> <i16 -1, i16 -2> to <2 x ptr addrspace(2)>
|
|
%gep = getelementptr i8, <2 x ptr addrspace(2)> %base, <2 x i8> <i8 1, i8 2>
|
|
ret <2 x ptr addrspace(2)> %gep
|
|
}
|
|
|
|
;; The same is true for pointers with external state: no new inttoptr
|
|
define <2 x ptr addrspace(3)> @test_vec_null_base_external() {
|
|
; CHECK-LABEL: define <2 x ptr addrspace(3)> @test_vec_null_base_external() {
|
|
; CHECK-NEXT: ret <2 x ptr addrspace(3)> getelementptr (i8, <2 x ptr addrspace(3)> splat (ptr addrspace(3) null), <2 x i8> <i8 -2, i8 -3>)
|
|
;
|
|
%gep = getelementptr i8, <2 x ptr addrspace(3)> <ptr addrspace(3) null, ptr addrspace(3) null>, <2 x i8> <i8 -2, i8 -3>
|
|
ret <2 x ptr addrspace(3)> %gep
|
|
}
|
|
|
|
define <2 x ptr addrspace(3)> @test_vec_inttoptr_base_external() {
|
|
; CHECK-LABEL: define <2 x ptr addrspace(3)> @test_vec_inttoptr_base_external() {
|
|
; CHECK-NEXT: ret <2 x ptr addrspace(3)> getelementptr (i8, <2 x ptr addrspace(3)> <ptr addrspace(3) inttoptr (i16 -1 to ptr addrspace(3)), ptr addrspace(3) inttoptr (i16 -2 to ptr addrspace(3))>, <2 x i8> <i8 1, i8 2>)
|
|
;
|
|
%base = inttoptr <2 x i16> <i16 -1, i16 -2> to <2 x ptr addrspace(3)>
|
|
%gep = getelementptr i8, <2 x ptr addrspace(3)> %base, <2 x i8> <i8 1, i8 2>
|
|
ret <2 x ptr addrspace(3)> %gep
|
|
}
|