Files
TheRock/compiler/amd-llvm/llvm/test/Analysis/CostModel/RISCV/gep-zero-indices.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

103 lines
4.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
; RUN: opt -mtriple=riscv32 -mattr=+v -passes="print<cost-model>" 2>&1 -disable-output < %s \
; RUN: | FileCheck %s
; RUN: opt -mtriple=riscv64 -mattr=+v -passes="print<cost-model>" 2>&1 -disable-output < %s \
; RUN: | FileCheck %s
; These GEPs should all cost zero becuase all the indices operands are zero, so
; no computation actually needs to happen.
define ptr @zero_indices_i8(ptr %p) {
; CHECK-LABEL: 'zero_indices_i8'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i8, ptr %p, i32 0
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
;
%x = getelementptr i8, ptr %p, i32 0
ret ptr %x
}
define ptr @zero_indices_i16(ptr %p) {
; CHECK-LABEL: 'zero_indices_i16'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i16, ptr %p, i32 0
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
;
%x = getelementptr i16, ptr %p, i32 0
ret ptr %x
}
define ptr @zero_indices_i32(ptr %p) {
; CHECK-LABEL: 'zero_indices_i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i32, ptr %p, i32 0
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
;
%x = getelementptr i32, ptr %p, i32 0
ret ptr %x
}
define ptr @zero_indices_i64(ptr %p) {
; CHECK-LABEL: 'zero_indices_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i64, ptr %p, i32 0
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
;
%x = getelementptr i64, ptr %p, i32 0
ret ptr %x
}
define ptr @zero_indices_array(ptr %p) {
; CHECK-LABEL: 'zero_indices_array'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr [42 x i64], ptr %p, i32 0, i32 0
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
;
%x = getelementptr [42 x i64], ptr %p, i32 0, i32 0
ret ptr %x
}
%struct = type { %struct.inner }
%struct.inner = type { %struct.inner.inner }
%struct.inner.inner = type { i32 }
define ptr @zero_indices_struct(ptr %p) {
; CHECK-LABEL: 'zero_indices_struct'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr %struct, ptr %p, i32 0, i32 0, i32 0
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
;
%x = getelementptr %struct, ptr %p, i32 0, i32 0, i32 0
ret ptr %x
}
define <4 x ptr> @zero_indices_v4i32(<4 x ptr> %p) {
; CHECK-LABEL: 'zero_indices_v4i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i32, <4 x ptr> %p, <4 x i32> zeroinitializer
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x ptr> %x
;
%x = getelementptr i32, <4 x ptr> %p, <4 x i32> zeroinitializer
ret <4 x ptr> %x
}
define <16 x ptr> @zero_indices_v16i32(<16 x ptr> %p) {
; CHECK-LABEL: 'zero_indices_v16i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i32, <16 x ptr> %p, <16 x i32> zeroinitializer
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x ptr> %x
;
%x = getelementptr i32, <16 x ptr> %p, <16 x i32> zeroinitializer
ret <16 x ptr> %x
}
define <4 x ptr> @zero_indices_v4f32(<4 x ptr> %p) {
; CHECK-LABEL: 'zero_indices_v4f32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr float, <4 x ptr> %p, <4 x i32> zeroinitializer
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x ptr> %x
;
%x = getelementptr float, <4 x ptr> %p, <4 x i32> zeroinitializer
ret <4 x ptr> %x
}
define <4 x ptr> @zero_indices_v4v4i32(<4 x ptr> %p) {
; CHECK-LABEL: 'zero_indices_v4v4i32'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr <32 x i32>, <4 x ptr> %p, <4 x i32> zeroinitializer, <4 x i32> zeroinitializer
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x ptr> %x
;
%x = getelementptr <32 x i32>, <4 x ptr> %p, <4 x i32> zeroinitializer, <4 x i32> zeroinitializer
ret <4 x ptr> %x
}