Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/GlobalOpt/fastcc.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

138 lines
4.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt < %s -passes=globalopt -S | FileCheck %s
declare token @llvm.call.preallocated.setup(i32)
declare ptr @llvm.call.preallocated.arg(token, i32)
define internal i32 @f(ptr %m) {
; CHECK-LABEL: define internal fastcc i32 @f(
; CHECK-SAME: ptr [[M:%.*]]) unnamed_addr {
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[M]], align 4
; CHECK-NEXT: ret i32 [[V]]
;
%v = load i32, ptr %m
ret i32 %v
}
define internal x86_thiscallcc i32 @g(ptr %m) {
; CHECK-LABEL: define internal fastcc i32 @g(
; CHECK-SAME: ptr [[M:%.*]]) unnamed_addr {
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[M]], align 4
; CHECK-NEXT: ret i32 [[V]]
;
%v = load i32, ptr %m
ret i32 %v
}
; Leave this one alone, because the user went out of their way to request this
; convention.
define internal coldcc i32 @h(ptr %m) {
; CHECK-LABEL: define internal coldcc i32 @h(
; CHECK-SAME: ptr [[M:%.*]]) unnamed_addr {
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[M]], align 4
; CHECK-NEXT: ret i32 [[V]]
;
%v = load i32, ptr %m
ret i32 %v
}
define internal i32 @j(ptr %m) {
; CHECK-LABEL: define internal i32 @j(
; CHECK-SAME: ptr [[M:%.*]]) {
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[M]], align 4
; CHECK-NEXT: ret i32 [[V]]
;
%v = load i32, ptr %m
ret i32 %v
}
define internal i32 @inalloca(ptr inalloca(i32) %p) {
; CHECK-LABEL: define internal fastcc i32 @inalloca(
; CHECK-SAME: ptr [[P:%.*]]) unnamed_addr {
; CHECK-NEXT: [[RV:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: ret i32 [[RV]]
;
%rv = load i32, ptr %p
ret i32 %rv
}
define i32 @inalloca2_caller(ptr inalloca(i32) %p) {
; CHECK-LABEL: define i32 @inalloca2_caller(
; CHECK-SAME: ptr inalloca(i32) [[P:%.*]]) local_unnamed_addr {
; CHECK-NEXT: [[RV:%.*]] = musttail call i32 @inalloca2(ptr inalloca(i32) [[P]])
; CHECK-NEXT: ret i32 [[RV]]
;
%rv = musttail call i32 @inalloca2(ptr inalloca(i32) %p)
ret i32 %rv
}
define internal i32 @inalloca2(ptr inalloca(i32) %p) {
; Because of the musttail caller, this inalloca cannot be dropped.
; CHECK-LABEL: define internal i32 @inalloca2(
; CHECK-SAME: ptr inalloca(i32) [[P:%.*]]) unnamed_addr {
; CHECK-NEXT: [[RV:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: ret i32 [[RV]]
;
%rv = load i32, ptr %p
ret i32 %rv
}
define internal i32 @preallocated(ptr preallocated(i32) %p) {
; CHECK-LABEL: define internal fastcc i32 @preallocated(
; CHECK-SAME: ptr [[P:%.*]]) unnamed_addr {
; CHECK-NEXT: [[RV:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: ret i32 [[RV]]
;
%rv = load i32, ptr %p
ret i32 %rv
}
define void @call_things() {
; CHECK-LABEL: define void @call_things() local_unnamed_addr {
; CHECK-NEXT: [[M:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[TMP1:%.*]] = call fastcc i32 @f(ptr [[M]])
; CHECK-NEXT: [[TMP2:%.*]] = call fastcc i32 @g(ptr [[M]])
; CHECK-NEXT: [[TMP3:%.*]] = call coldcc i32 @h(ptr [[M]])
; CHECK-NEXT: [[TMP4:%.*]] = call i32 @j(ptr [[M]])
; CHECK-NEXT: [[ARGS:%.*]] = alloca inalloca i32, align 4
; CHECK-NEXT: [[TMP5:%.*]] = call fastcc i32 @inalloca(ptr [[ARGS]])
; CHECK-NEXT: [[TMP6:%.*]] = call ptr @llvm.stacksave.p0()
; CHECK-NEXT: [[PAARG:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[TMP7:%.*]] = call fastcc i32 @preallocated(ptr [[PAARG]])
; CHECK-NEXT: call void @llvm.stackrestore.p0(ptr [[TMP6]])
; CHECK-NEXT: ret void
;
%m = alloca i32
call i32 @f(ptr %m)
call x86_thiscallcc i32 @g(ptr %m)
call coldcc i32 @h(ptr %m)
call i32 @j(ptr %m)
%args = alloca inalloca i32
call i32 @inalloca(ptr inalloca(i32) %args)
%c = call token @llvm.call.preallocated.setup(i32 1)
%N = call ptr @llvm.call.preallocated.arg(token %c, i32 0) preallocated(i32)
call i32 @preallocated(ptr preallocated(i32) %N) ["preallocated"(token %c)]
ret void
}
@llvm.used = appending global [1 x ptr] [
ptr @j
], section "llvm.metadata"
define internal i32 @assume_fastcc() {
; CHECK-LABEL: define internal fastcc i32 @assume_fastcc() {
; CHECK-NEXT: [[OBJSIZE:%.*]] = call i32 @llvm.objectsize.i32.p0(ptr @assume_fastcc, i1 false, i1 false, i1 false)
; CHECK-NEXT: ret i32 [[OBJSIZE]]
;
%objsize = call i32 @llvm.objectsize.i32.p0(ptr @assume_fastcc, i1 false, i1 false, i1 false)
ret i32 %objsize
}
define internal i32 @constexpr_self_user() addrspace(1) {
; CHECK-LABEL: define internal fastcc i32 @constexpr_self_user() addrspace(1) {
; CHECK-NEXT: [[OBJSIZE:%.*]] = call i32 @llvm.objectsize.i32.p0(ptr addrspacecast (ptr addrspace(1) @constexpr_self_user to ptr), i1 false, i1 false, i1 false)
; CHECK-NEXT: ret i32 [[OBJSIZE]]
;
%objsize = call i32 @llvm.objectsize.i32.p0(ptr addrspacecast (ptr addrspace(1) @constexpr_self_user to ptr), i1 false, i1 false, i1 false)
ret i32 %objsize
}