Files
TheRock/compiler/amd-llvm/mlir/test/Target/LLVMIR/ifunc.mlir
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

71 lines
2.4 KiB
MLIR

// RUN: mlir-translate -mlir-to-llvmir %s --split-input-file | FileCheck %s
// CHECK: @foo = dso_local ifunc void (ptr, i32), ptr @resolve_foo
llvm.mlir.ifunc external @foo : !llvm.func<void (ptr, i32)>, !llvm.ptr @resolve_foo {dso_local}
llvm.func @call_foo(%arg0: !llvm.ptr {llvm.noundef}, %arg1: i32 {llvm.noundef}) attributes {dso_local} {
// CHECK: call void @foo
llvm.call @foo(%arg0, %arg1) : (!llvm.ptr {llvm.noundef}, i32 {llvm.noundef}) -> ()
llvm.return
}
llvm.func @foo_fptr() -> !llvm.ptr attributes {dso_local} {
%1 = llvm.mlir.addressof @foo : !llvm.ptr
// CHECK: ret ptr @foo
llvm.return %1 : !llvm.ptr
}
llvm.func internal @resolve_foo() -> !llvm.ptr attributes {dso_local} {
%0 = llvm.mlir.addressof @foo_1 : !llvm.ptr
llvm.return %0 : !llvm.ptr
}
llvm.func @foo_1(!llvm.ptr {llvm.noundef}, i32 {llvm.noundef})
// -----
llvm.mlir.alias external @resolver_alias : !llvm.func<ptr ()> {
%0 = llvm.mlir.addressof @resolver : !llvm.ptr
llvm.return %0 : !llvm.ptr
}
llvm.mlir.alias external @resolver_alias_alias : !llvm.func<ptr ()> {
%0 = llvm.mlir.addressof @resolver_alias : !llvm.ptr
llvm.return %0 : !llvm.ptr
}
// CHECK-DAG: @ifunc = ifunc float (i64), ptr @resolver_alias
// CHECK-DAG: @ifunc2 = ifunc float (i64), ptr @resolver_alias_alias
llvm.mlir.ifunc external @ifunc2 : !llvm.func<f32 (i64)>, !llvm.ptr @resolver_alias_alias
llvm.mlir.ifunc external @ifunc : !llvm.func<f32 (i64)>, !llvm.ptr @resolver_alias
llvm.func @resolver() -> !llvm.ptr {
%0 = llvm.mlir.constant(333 : i64) : i64
%1 = llvm.inttoptr %0 : i64 to !llvm.ptr
llvm.return %1 : !llvm.ptr
}
// -----
// CHECK: @ifunc = linkonce_odr hidden ifunc
llvm.mlir.ifunc linkonce_odr hidden @ifunc : !llvm.func<f32 (i64)>, !llvm.ptr @resolver {dso_local}
llvm.func @resolver() -> !llvm.ptr {
%0 = llvm.mlir.constant(333 : i64) : i64
%1 = llvm.inttoptr %0 : i64 to !llvm.ptr
llvm.return %1 : !llvm.ptr
}
// -----
// CHECK: @ifunc = private ifunc
llvm.mlir.ifunc private @ifunc : !llvm.func<f32 (i64)>, !llvm.ptr @resolver {dso_local}
llvm.func @resolver() -> !llvm.ptr {
%0 = llvm.mlir.constant(333 : i64) : i64
%1 = llvm.inttoptr %0 : i64 to !llvm.ptr
llvm.return %1 : !llvm.ptr
}
// -----
// CHECK: @ifunc = weak ifunc
llvm.mlir.ifunc weak @ifunc : !llvm.func<f32 (i64)>, !llvm.ptr @resolver
llvm.func @resolver() -> !llvm.ptr {
%0 = llvm.mlir.constant(333 : i64) : i64
%1 = llvm.inttoptr %0 : i64 to !llvm.ptr
llvm.return %1 : !llvm.ptr
}