Files
TheRock/compiler/amd-llvm/mlir/test/IR/test-symbol-uses.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

108 lines
3.7 KiB
MLIR

// RUN: mlir-opt -allow-unregistered-dialect %s -test-symbol-uses -split-input-file -verify-diagnostics
// Symbol references to the module itself don't affect uses of symbols within
// its table.
// expected-remark@below {{symbol_removable function successfully erased}}
module attributes {sym.outside_use = @symbol_foo } {
// expected-remark@+1 {{symbol has 3 uses}}
func.func private @symbol_foo()
// expected-remark@below {{symbol has no uses}}
// expected-remark@below {{found use of symbol : @symbol_foo}}
// expected-remark@below {{symbol contains 3 nested references}}
func.func @symbol_bar() attributes {sym.use = @symbol_foo} {
// expected-remark@+1 {{found use of symbol : @symbol_foo}}
"foo.op"() {
non_symbol_attr,
use = [{nested_symbol = [@symbol_foo]}],
z_other_non_symbol_attr
} : () -> ()
// expected-remark@+1 {{found use of symbol : @symbol_foo}}
"foo.op"() { use = distinct[0]<@symbol_foo> } : () -> ()
}
// expected-remark@below {{symbol has no uses}}
func.func private @symbol_removable()
// expected-remark@+1 {{symbol has 1 use}}
func.func private @symbol_baz()
// expected-remark@+1 {{found use of symbol : @symbol_baz}}
module attributes {test.reference = @symbol_baz} {
"foo.op"() {test.nested_reference = @symbol_baz} : () -> ()
}
}
// -----
// Test nested attribute support
module {
// expected-remark@+1 {{symbol has 2 uses}}
module @module_b {
// expected-remark@+1 {{symbol has 1 uses}}
module @module_c {
// expected-remark@+1 {{symbol has 1 uses}}
func.func nested @foo()
}
}
// expected-remark@below {{symbol has no uses}}
// expected-remark@below {{symbol contains 2 nested references}}
func.func @symbol_bar() {
// expected-remark@below {{found use of symbol : @module_b::@module_c::@foo : "foo"}}
// expected-remark@below {{found use of symbol : @module_b::@module_c::@foo : "module_c"}}
// expected-remark@below {{found use of symbol : @module_b::@module_c::@foo : "module_b"}}
// expected-remark@below {{found use of symbol : @module_b : "module_b"}}
"foo.op"() {
use_1 = [{ nested_symbol = [@module_b::@module_c::@foo]}],
use_2 = @module_b
} : () -> ()
}
}
// -----
// expected-remark@+1 {{contains an unknown nested operation that 'may' define a new symbol table}}
func.func @symbol_bar() {
"foo.possibly_unknown_symbol_table"() ({
}) : () -> ()
}
// -----
module {
// expected-remark@below {{symbol has 2 uses}}
module @inner_module {
// expected-remark@below {{symbol has 1 uses}}
func.func private @private_inner()
// expected-remark@below {{symbol has 1 uses}}
func.func nested @nested_inner()
}
// expected-remark@below {{symbol has no uses}}
// expected-remark@below {{symbol contains 2 nested references}}
func.func @outer_caller() {
// expected-remark@below {{found use of symbol : @inner_module::@nested_inner : "inner_module"}}
// expected-remark@below {{found use of symbol : @inner_module::@nested_inner : "nested_inner"}}
"foo.op"() { use = @inner_module::@nested_inner } : () -> ()
// expected-remark@below {{failed to resolve use of symbol : @inner_module::@private_inner : "inner_module"}}
// expected-remark@below {{failed to resolve use of symbol : @inner_module::@private_inner : "private_inner"}}
"foo.op"() { use = @inner_module::@private_inner } : () -> ()
return
}
}
// -----
// Test that external functions in nested modules are not incorrectly erased
// from the outer module's symbol table.
// Regression test for https://github.com/llvm/llvm-project/issues/60583
module {
module {
// expected-remark@below {{symbol has no uses}}
func.func private @printMemrefF32(%ptr : memref<*xf32>)
}
}