Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstSimplify/opaque-ptr.ll
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

112 lines
3.6 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=instsimplify < %s | FileCheck %s
define ptr @gep_zero_indices(ptr %p) {
; CHECK-LABEL: @gep_zero_indices(
; CHECK-NEXT: ret ptr [[P:%.*]]
;
%p2 = getelementptr { i64, i64 }, ptr %p, i64 0, i32 0
ret ptr %p2
}
define ptr @gep_non_zero_indices1(ptr %p) {
; CHECK-LABEL: @gep_non_zero_indices1(
; CHECK-NEXT: [[P2:%.*]] = getelementptr { i64, i64 }, ptr [[P:%.*]], i64 0, i32 1
; CHECK-NEXT: ret ptr [[P2]]
;
%p2 = getelementptr { i64, i64 }, ptr %p, i64 0, i32 1
ret ptr %p2
}
define ptr @gep_non_zero_indices2(ptr %p) {
; CHECK-LABEL: @gep_non_zero_indices2(
; CHECK-NEXT: [[P2:%.*]] = getelementptr { i64, i64 }, ptr [[P:%.*]], i64 1, i32 0
; CHECK-NEXT: ret ptr [[P2]]
;
%p2 = getelementptr { i64, i64 }, ptr %p, i64 1, i32 0
ret ptr %p2
}
define <2 x ptr> @scalar_base_vector_index(ptr %p) {
; CHECK-LABEL: @scalar_base_vector_index(
; CHECK-NEXT: [[G:%.*]] = getelementptr { i64, i64 }, ptr [[P:%.*]], <2 x i64> zeroinitializer, i32 0
; CHECK-NEXT: ret <2 x ptr> [[G]]
;
%g = getelementptr { i64, i64 }, ptr %p, <2 x i64> zeroinitializer, i32 0
ret <2 x ptr> %g
}
define <2 x ptr> @vector_base_vector_index(<2 x ptr> %p) {
; CHECK-LABEL: @vector_base_vector_index(
; CHECK-NEXT: ret <2 x ptr> [[P:%.*]]
;
%g = getelementptr { i64, i64 }, <2 x ptr> %p, <2 x i64> zeroinitializer, i32 0
ret <2 x ptr> %g
}
define <2 x ptr> @vector_base_scalar_index(<2 x ptr> %p) {
; CHECK-LABEL: @vector_base_scalar_index(
; CHECK-NEXT: ret <2 x ptr> [[P:%.*]]
;
%g = getelementptr { i64, i64 }, <2 x ptr> %p, i64 0, i32 0
ret <2 x ptr> %g
}
@g = external global [2 x i32]
define ptr @constexpr_zero_gep_scalar_base_scalar_index() {
; CHECK-LABEL: @constexpr_zero_gep_scalar_base_scalar_index(
; CHECK-NEXT: ret ptr @g
;
ret ptr @g
}
define <2 x ptr> @constexpr_zero_gep_vector_base_scalar_index() {
; CHECK-LABEL: @constexpr_zero_gep_vector_base_scalar_index(
; CHECK-NEXT: ret <2 x ptr> <ptr @g, ptr @g>
;
ret <2 x ptr> getelementptr ([2 x i32], <2 x ptr> <ptr @g, ptr @g>, i64 0, i64 0)
}
define <2 x ptr> @constexpr_zero_gep_scalar_base_vector_index() {
; CHECK-LABEL: @constexpr_zero_gep_scalar_base_vector_index(
; CHECK-NEXT: ret <2 x ptr> <ptr @g, ptr @g>
;
ret <2 x ptr> getelementptr ([2 x i32], ptr @g, <2 x i64> zeroinitializer, i64 0)
}
define <2 x ptr> @constexpr_zero_gep_vector_base_vector_index() {
; CHECK-LABEL: @constexpr_zero_gep_vector_base_vector_index(
; CHECK-NEXT: ret <2 x ptr> <ptr @g, ptr @g>
;
ret <2 x ptr> getelementptr ([2 x i32], <2 x ptr> <ptr @g, ptr @g>, <2 x i64> zeroinitializer, i64 0)
}
define ptr @constexpr_undef_gep_scalar_base_scalar_index() {
; CHECK-LABEL: @constexpr_undef_gep_scalar_base_scalar_index(
; CHECK-NEXT: ret ptr @g
;
ret ptr getelementptr ([2 x i32], ptr @g, i64 0, i64 undef)
}
define <2 x ptr> @constexpr_undef_gep_vector_base_scalar_index() {
; CHECK-LABEL: @constexpr_undef_gep_vector_base_scalar_index(
; CHECK-NEXT: ret <2 x ptr> <ptr @g, ptr @g>
;
ret <2 x ptr> getelementptr ([2 x i32], <2 x ptr> <ptr @g, ptr @g>, i64 undef, i64 undef)
}
define <2 x ptr> @constexpr_undef_gep_scalar_base_vector_index() {
; CHECK-LABEL: @constexpr_undef_gep_scalar_base_vector_index(
; CHECK-NEXT: ret <2 x ptr> <ptr @g, ptr @g>
;
ret <2 x ptr> getelementptr ([2 x i32], ptr @g, <2 x i64> undef, i64 0)
}
define <2 x ptr> @constexpr_undef_gep_vector_base_vector_index() {
; CHECK-LABEL: @constexpr_undef_gep_vector_base_vector_index(
; CHECK-NEXT: ret <2 x ptr> <ptr @g, ptr @g>
;
ret <2 x ptr> getelementptr ([2 x i32], <2 x ptr> <ptr @g, ptr @g>, <2 x i64> undef, i64 0)
}