Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/SROA/lifetime-intrinsic.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

62 lines
2.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes='sroa<preserve-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG
; RUN: opt < %s -passes='sroa<modify-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG
%i32x2 = type { [2 x i32] }
; Note %arr is the union
; union {
; int i[2];
; short s[4];
; };
define i16 @with_lifetime(i32 %a, i32 %b) #0 {
; CHECK-LABEL: @with_lifetime(
; CHECK-NEXT: [[ARR_SROA_0_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[A:%.*]] to i16
; CHECK-NEXT: [[ARR_SROA_4_4_EXTRACT_TRUNC:%.*]] = trunc i32 [[B:%.*]] to i16
; CHECK-NEXT: [[RET:%.*]] = add i16 [[ARR_SROA_0_0_EXTRACT_TRUNC]], [[ARR_SROA_4_4_EXTRACT_TRUNC]]
; CHECK-NEXT: ret i16 [[RET]]
;
%arr = alloca %i32x2, align 4
call void @llvm.lifetime.start.p0(ptr %arr)
%p1 = getelementptr inbounds %i32x2, ptr %arr, i64 0, i32 0, i32 1
store i32 %a, ptr %arr, align 4
store i32 %b, ptr %p1, align 4
%s0 = load i16, ptr %arr, align 4
%s2 = load i16, ptr %p1, align 4
%ret = add i16 %s0, %s2
call void @llvm.lifetime.end.p0(ptr %arr)
ret i16 %ret
}
define i16 @no_lifetime(i32 %a, i32 %b) #0 {
; CHECK-LABEL: @no_lifetime(
; CHECK-NEXT: [[ARR_SROA_0_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[A:%.*]] to i16
; CHECK-NEXT: [[ARR_SROA_2_0_EXTRACT_SHIFT:%.*]] = lshr i32 [[A]], 16
; CHECK-NEXT: [[ARR_SROA_2_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[ARR_SROA_2_0_EXTRACT_SHIFT]] to i16
; CHECK-NEXT: [[ARR_SROA_21_4_EXTRACT_TRUNC:%.*]] = trunc i32 [[B:%.*]] to i16
; CHECK-NEXT: [[ARR_SROA_4_4_EXTRACT_SHIFT:%.*]] = lshr i32 [[B]], 16
; CHECK-NEXT: [[ARR_SROA_4_4_EXTRACT_TRUNC:%.*]] = trunc i32 [[ARR_SROA_4_4_EXTRACT_SHIFT]] to i16
; CHECK-NEXT: [[RET:%.*]] = add i16 [[ARR_SROA_0_0_EXTRACT_TRUNC]], [[ARR_SROA_21_4_EXTRACT_TRUNC]]
; CHECK-NEXT: ret i16 [[RET]]
;
%arr = alloca %i32x2, align 4
%p1 = getelementptr inbounds %i32x2, ptr %arr, i64 0, i32 0, i32 1
store i32 %a, ptr %arr, align 4
store i32 %b, ptr %p1, align 4
%s0 = load i16, ptr %arr, align 4
%s2 = load i16, ptr %p1, align 4
%ret = add i16 %s0, %s2
ret i16 %ret
}
declare void @llvm.lifetime.start.p0(ptr nocapture) #1
declare void @llvm.lifetime.end.p0(ptr nocapture) #1
attributes #0 = { alwaysinline nounwind }
attributes #1 = { argmemonly nounwind }
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK-MODIFY-CFG: {{.*}}
; CHECK-PRESERVE-CFG: {{.*}}