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
141 lines
6.1 KiB
LLVM
141 lines
6.1 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -S -passes='cgscc(inline)' -pass-remarks=inline -pass-remarks-missed=inline < %s 2> %t.err | FileCheck %s
|
|
; RUN: FileCheck -implicit-check-not=remark -check-prefix=REMARK %s < %t.err
|
|
|
|
; REMARK: remark: <unknown>:0:0: 'callee_with_gc' inlined into 'caller_no_gc'
|
|
; REMARK-NEXT: remark: <unknown>:0:0: 'callee_with_gc' inlined into 'caller_same_gc'
|
|
; REMARK-NEXT: remark: <unknown>:0:0: 'callee_with_gc' is not inlined into 'caller_incompatible_gc': incompatible GC
|
|
; REMARK-NEXT: remark: <unknown>:0:0: 'callee_with_gc' inlined into 'caller_inline_first_caller'
|
|
; REMARK-NEXT: remark: <unknown>:0:0: 'callee_with_other_gc' is not inlined into 'caller_inline_first_caller': incompatible GC
|
|
; REMARK-NEXT: remark: <unknown>:0:0: 'callee_with_gc' inlined into 'caller_inline_second_caller'
|
|
; REMARK-NEXT: remark: <unknown>:0:0: 'callee_with_other_gc' is not inlined into 'caller_inline_second_caller': incompatible GC
|
|
|
|
%IntArray = type { i32, [0 x ptr] }
|
|
|
|
; Callee gc propagates to the caller
|
|
define i32 @caller_no_gc() {
|
|
; CHECK-LABEL: define i32 @caller_no_gc() gc "example" {
|
|
; CHECK-NEXT: [[ROOT_I:%.*]] = alloca ptr, align 8
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: call void @llvm.gcroot(ptr [[ROOT_I]], ptr null)
|
|
; CHECK-NEXT: [[OBJ_I:%.*]] = call ptr @h()
|
|
; CHECK-NEXT: store ptr [[OBJ_I]], ptr [[ROOT_I]], align 8
|
|
; CHECK-NEXT: [[LENGTH_I:%.*]] = load i32, ptr [[OBJ_I]], align 4
|
|
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: ret i32 [[LENGTH_I]]
|
|
;
|
|
%x = call i32 @callee_with_gc()
|
|
ret i32 %x
|
|
}
|
|
|
|
; Inline of matching gc allowed.
|
|
define i32 @caller_same_gc() gc "example" {
|
|
; CHECK-LABEL: define i32 @caller_same_gc() gc "example" {
|
|
; CHECK-NEXT: [[ROOT_I:%.*]] = alloca ptr, align 8
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: call void @llvm.gcroot(ptr [[ROOT_I]], ptr null)
|
|
; CHECK-NEXT: [[OBJ_I:%.*]] = call ptr @h()
|
|
; CHECK-NEXT: store ptr [[OBJ_I]], ptr [[ROOT_I]], align 8
|
|
; CHECK-NEXT: [[LENGTH_I:%.*]] = load i32, ptr [[OBJ_I]], align 4
|
|
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: ret i32 [[LENGTH_I]]
|
|
;
|
|
%x = call i32 @callee_with_gc()
|
|
ret i32 %x
|
|
}
|
|
|
|
; Reject inline with mismatched gc
|
|
define i32 @caller_incompatible_gc() gc "incompatible" {
|
|
; CHECK-LABEL: define i32 @caller_incompatible_gc() gc "incompatible" {
|
|
; CHECK-NEXT: [[X:%.*]] = call i32 @callee_with_gc()
|
|
; CHECK-NEXT: ret i32 [[X]]
|
|
;
|
|
%x = call i32 @callee_with_gc()
|
|
ret i32 %x
|
|
}
|
|
|
|
define i32 @callee_with_gc() gc "example" {
|
|
; CHECK-LABEL: define i32 @callee_with_gc() gc "example" {
|
|
; CHECK-NEXT: [[ROOT:%.*]] = alloca ptr, align 8
|
|
; CHECK-NEXT: call void @llvm.gcroot(ptr [[ROOT]], ptr null)
|
|
; CHECK-NEXT: [[OBJ:%.*]] = call ptr @h()
|
|
; CHECK-NEXT: store ptr [[OBJ]], ptr [[ROOT]], align 8
|
|
; CHECK-NEXT: [[LENGTH_PTR:%.*]] = getelementptr [[INTARRAY:%.*]], ptr [[OBJ]], i32 0, i32 0
|
|
; CHECK-NEXT: [[LENGTH:%.*]] = load i32, ptr [[LENGTH_PTR]], align 4
|
|
; CHECK-NEXT: ret i32 [[LENGTH]]
|
|
;
|
|
%root = alloca ptr, align 8
|
|
call void @llvm.gcroot(ptr %root, ptr null)
|
|
%obj = call ptr @h()
|
|
store ptr %obj, ptr %root, align 8
|
|
%Length.ptr = getelementptr %IntArray, ptr %obj, i32 0, i32 0
|
|
%Length = load i32, ptr %Length.ptr, align 4
|
|
ret i32 %Length
|
|
}
|
|
|
|
define i32 @callee_with_other_gc() gc "other-example" {
|
|
; CHECK-LABEL: define i32 @callee_with_other_gc() gc "other-example" {
|
|
; CHECK-NEXT: [[ROOT:%.*]] = alloca ptr, align 8
|
|
; CHECK-NEXT: call void @llvm.gcroot(ptr [[ROOT]], ptr null)
|
|
; CHECK-NEXT: [[OBJ:%.*]] = call ptr @h()
|
|
; CHECK-NEXT: store ptr [[OBJ]], ptr [[ROOT]], align 8
|
|
; CHECK-NEXT: [[LENGTH_PTR:%.*]] = getelementptr [[INTARRAY:%.*]], ptr [[OBJ]], i32 0, i32 0
|
|
; CHECK-NEXT: [[LENGTH:%.*]] = load i32, ptr [[LENGTH_PTR]], align 4
|
|
; CHECK-NEXT: ret i32 [[LENGTH]]
|
|
;
|
|
%root = alloca ptr, align 8
|
|
call void @llvm.gcroot(ptr %root, ptr null)
|
|
%obj = call ptr @h()
|
|
store ptr %obj, ptr %root, align 8
|
|
%Length.ptr = getelementptr %IntArray, ptr %obj, i32 0, i32 0
|
|
%Length = load i32, ptr %Length.ptr, align 4
|
|
ret i32 %Length
|
|
}
|
|
|
|
; After inlining the first call, inline is blocked of the second call
|
|
; since the gc type propagates to the caller.
|
|
define i32 @caller_inline_first_caller() {
|
|
; CHECK-LABEL: define i32 @caller_inline_first_caller() gc "example" {
|
|
; CHECK-NEXT: [[ROOT_I:%.*]] = alloca ptr, align 8
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: call void @llvm.gcroot(ptr [[ROOT_I]], ptr null)
|
|
; CHECK-NEXT: [[OBJ_I:%.*]] = call ptr @h()
|
|
; CHECK-NEXT: store ptr [[OBJ_I]], ptr [[ROOT_I]], align 8
|
|
; CHECK-NEXT: [[LENGTH_I:%.*]] = load i32, ptr [[OBJ_I]], align 4
|
|
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: [[Y:%.*]] = call i32 @callee_with_other_gc()
|
|
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[LENGTH_I]], [[Y]]
|
|
; CHECK-NEXT: ret i32 [[ADD]]
|
|
;
|
|
%x = call i32 @callee_with_gc()
|
|
%y = call i32 @callee_with_other_gc()
|
|
%add = add i32 %x, %y
|
|
ret i32 %add
|
|
}
|
|
|
|
; We can't inline the first call due to the incompatible gc, but can
|
|
; inline the second
|
|
define i32 @caller_inline_second_caller() gc "example" {
|
|
; CHECK-LABEL: define i32 @caller_inline_second_caller() gc "example" {
|
|
; CHECK-NEXT: [[ROOT_I:%.*]] = alloca ptr, align 8
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: call void @llvm.gcroot(ptr [[ROOT_I]], ptr null)
|
|
; CHECK-NEXT: [[OBJ_I:%.*]] = call ptr @h()
|
|
; CHECK-NEXT: store ptr [[OBJ_I]], ptr [[ROOT_I]], align 8
|
|
; CHECK-NEXT: [[LENGTH_I:%.*]] = load i32, ptr [[OBJ_I]], align 4
|
|
; CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr [[ROOT_I]])
|
|
; CHECK-NEXT: [[Y:%.*]] = call i32 @callee_with_other_gc()
|
|
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[LENGTH_I]], [[Y]]
|
|
; CHECK-NEXT: ret i32 [[ADD]]
|
|
;
|
|
%x = call i32 @callee_with_gc()
|
|
%y = call i32 @callee_with_other_gc()
|
|
%add = add i32 %x, %y
|
|
ret i32 %add
|
|
}
|
|
|
|
declare ptr @h()
|
|
|
|
declare void @llvm.gcroot(ptr, ptr) #0
|
|
attributes #0 = { nounwind }
|