Files
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

89 lines
2.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes='require<collector-metadata>,function(gc-lowering)' < %s | FileCheck %s
declare ptr @llvm_gc_allocate(i32)
declare void @llvm_gc_initialize(i32)
declare void @llvm.gcroot(ptr, ptr)
declare void @llvm.gcwrite(ptr, ptr, ptr)
define i32 @main() gc "shadow-stack" {
; CHECK-LABEL: define i32 @main() gc "shadow-stack" {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = alloca ptr, align 8
; CHECK-NEXT: store ptr null, ptr [[A]], align 8
; CHECK-NEXT: [[B:%.*]] = alloca ptr, align 8
; CHECK-NEXT: store ptr null, ptr [[B]], align 8
; CHECK-NEXT: call void @llvm_gc_initialize(i32 1048576)
; CHECK-NEXT: call void @llvm.gcroot(ptr [[A]], ptr null)
; CHECK-NEXT: [[APTR:%.*]] = call ptr @llvm_gc_allocate(i32 10)
; CHECK-NEXT: store ptr [[APTR]], ptr [[A]], align 8
; CHECK-NEXT: call void @llvm.gcroot(ptr [[B]], ptr null)
; CHECK-NEXT: [[B_UPGRD_1:%.*]] = call ptr @llvm_gc_allocate(i32 8)
; CHECK-NEXT: store ptr [[B_UPGRD_1]], ptr [[B]], align 8
; CHECK-NEXT: [[B_1:%.*]] = load ptr, ptr [[B]], align 8
; CHECK-NEXT: [[A_1:%.*]] = load ptr, ptr [[A]], align 8
; CHECK-NEXT: store ptr [[A_1]], ptr [[B_1]], align 8
; CHECK-NEXT: ret i32 0
;
entry:
%A = alloca ptr
%B = alloca ptr
call void @llvm_gc_initialize(i32 1048576) ; Start with 1MB heap
;; ptr A;
call void @llvm.gcroot(ptr %A, ptr null)
;; A = gcalloc(10);
%Aptr = call ptr @llvm_gc_allocate(i32 10)
store ptr %Aptr, ptr %A
;; ptr B;
call void @llvm.gcroot(ptr %B, ptr null)
;; B = gcalloc(4);
%B.upgrd.1 = call ptr @llvm_gc_allocate(i32 8)
store ptr %B.upgrd.1, ptr %B
;; *B = A;
%B.1 = load ptr, ptr %B
%A.1 = load ptr, ptr %A
call void @llvm.gcwrite(ptr %A.1, ptr %B.upgrd.1, ptr %B.1)
ret i32 0
}
define void @no_gc() {
; CHECK-LABEL: define void @no_gc() {
; CHECK-NEXT: ret void
;
ret void
}
@metadata = constant i32 0
define void @non_ptr_alloca_root() gc "shadow-stack" {
; CHECK-LABEL: define void @non_ptr_alloca_root() gc "shadow-stack" {
; CHECK-NEXT: entry:
; CHECK-NEXT: %A = alloca double, align 8
; CHECK-NEXT: store double 0.000000e+00, ptr %A, align 8
; CHECK-NEXT: %B = alloca { double, double }, align 8
; CHECK-NEXT: store { double, double } zeroinitializer, ptr %B, align 8
; CHECK-NEXT: call void @llvm.gcroot(ptr %A, ptr @metadata)
; CHECK-NEXT: call void @llvm.gcroot(ptr %B, ptr @metadata)
; CHECK-NEXT: ret void
; CHECK-NEXT: }
entry:
%A = alloca double
%B = alloca { double, double }
;; ptr A;
call void @llvm.gcroot(ptr %A, ptr @metadata)
;; ptr B;
call void @llvm.gcroot(ptr %B, ptr @metadata)
ret void
}