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

93 lines
3.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=gvn -S | FileCheck %s
define i8 @test() nounwind {
; CHECK-LABEL: define i8 @test(
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[P:%.*]] = alloca [32 x i8], align 1
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr [[P]])
; CHECK-NEXT: store i8 1, ptr [[P]], align 1
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr [[P]])
; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[P]], align 1
; CHECK-NEXT: ret i8 [[TMP0]]
;
entry:
%P = alloca [32 x i8]
call void @llvm.lifetime.start.p0(ptr %P)
%0 = load i8, ptr %P
store i8 1, ptr %P
call void @llvm.lifetime.end.p0(ptr %P)
%1 = load i8, ptr %P
ret i8 %1
}
define void @assume_eq_arg(ptr %arg) {
; CHECK-LABEL: define void @assume_eq_arg(
; CHECK-SAME: ptr [[ARG:%.*]]) {
; CHECK-NEXT: [[ALLOCA:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[ALLOCA]], [[ARG]]
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr [[ALLOCA]])
; CHECK-NEXT: store volatile i32 0, ptr [[ALLOCA]], align 4
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr [[ALLOCA]])
; CHECK-NEXT: ret void
;
%alloca = alloca i32
%cmp = icmp eq ptr %alloca, %arg
call void @llvm.assume(i1 %cmp)
call void @llvm.lifetime.start.p0(ptr %alloca)
store volatile i32 0, ptr %alloca
call void @llvm.lifetime.end.p0(ptr %alloca)
ret void
}
define void @assume_eq_null() {
; CHECK-LABEL: define void @assume_eq_null() {
; CHECK-NEXT: [[ALLOCA:%.*]] = alloca i32, align 4, addrspace(1)
; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr addrspace(1) [[ALLOCA]], null
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
; CHECK-NEXT: call void @llvm.lifetime.start.p1(ptr addrspace(1) [[ALLOCA]])
; CHECK-NEXT: store volatile i32 0, ptr addrspace(1) null, align 4
; CHECK-NEXT: call void @llvm.lifetime.end.p1(ptr addrspace(1) [[ALLOCA]])
; CHECK-NEXT: ret void
;
%alloca = alloca i32, addrspace(1)
%cmp = icmp eq ptr addrspace(1) %alloca, null
call void @llvm.assume(i1 %cmp)
call void @llvm.lifetime.start.p1(ptr addrspace(1) %alloca)
store volatile i32 0, ptr addrspace(1) %alloca
call void @llvm.lifetime.end.p1(ptr addrspace(1) %alloca)
ret void
}
define void @dom_eq_null() {
; CHECK-LABEL: define void @dom_eq_null() {
; CHECK-NEXT: [[ALLOCA:%.*]] = alloca i32, align 4, addrspace(1)
; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr addrspace(1) [[ALLOCA]], null
; CHECK-NEXT: br i1 [[CMP]], label %[[IF:.*]], label %[[ELSE:.*]]
; CHECK: [[IF]]:
; CHECK-NEXT: call void @llvm.lifetime.start.p1(ptr addrspace(1) [[ALLOCA]])
; CHECK-NEXT: store volatile i32 0, ptr addrspace(1) null, align 4
; CHECK-NEXT: call void @llvm.lifetime.end.p1(ptr addrspace(1) [[ALLOCA]])
; CHECK-NEXT: ret void
; CHECK: [[ELSE]]:
; CHECK-NEXT: ret void
;
%alloca = alloca i32, addrspace(1)
%cmp = icmp eq ptr addrspace(1) %alloca, null
br i1 %cmp, label %if, label %else
if:
call void @llvm.lifetime.start.p1(ptr addrspace(1) %alloca)
store volatile i32 0, ptr addrspace(1) %alloca
call void @llvm.lifetime.end.p1(ptr addrspace(1) %alloca)
ret void
else:
ret void
}
declare void @llvm.lifetime.start.p0(ptr nocapture %P) readonly
declare void @llvm.lifetime.end.p0(ptr nocapture %P)