[Mlir-commits] [mlir] b7382ed - [MLIR] Extend Symbol verification to reject public symbol declarations.
Rahul Joshi
llvmlistbot at llvm.org
Mon Nov 16 16:06:11 PST 2020
Author: Rahul Joshi
Date: 2020-11-16T16:05:32-08:00
New Revision: b7382ed3fea08da27530a6d6d53f168fc704e4c4
URL: https://github.com/llvm/llvm-project/commit/b7382ed3fea08da27530a6d6d53f168fc704e4c4
DIFF: https://github.com/llvm/llvm-project/commit/b7382ed3fea08da27530a6d6d53f168fc704e4c4.diff
LOG: [MLIR] Extend Symbol verification to reject public symbol declarations.
- Extend the Symbol interface with `isDeclaration` to identify operations that declare
a symbol as opposed to define it.
- Extend verification to disallow public declarations as per the discussion in
https://llvm.discourse.group/t/rfc-symbol-definition-declaration-x-visibility-checks/2140
- Adopt the new interface for `FuncOp` and fix test and code to not have/create public
function declarations.
Differential Revision: https://reviews.llvm.org/D91456
Added:
Modified:
mlir/docs/SymbolsAndSymbolTables.md
mlir/include/mlir/IR/Function.h
mlir/include/mlir/IR/SymbolInterfaces.td
mlir/integration_test/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
mlir/integration_test/Dialect/Linalg/CPU/rank-reducing-subview.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-ncw-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-nwc-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nchw-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nhwc-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ncdhw-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ndhwc-call.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-elementwise.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-tensor-e2e.mlir
mlir/integration_test/Dialect/Linalg/CPU/test-tensor-matmul.mlir
mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir
mlir/integration_test/Dialect/Vector/CPU/test-vector-distribute.mlir
mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
mlir/test/Analysis/test-callgraph.mlir
mlir/test/Conversion/AffineToStandard/lower-affine.mlir
mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir
mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
mlir/test/Conversion/StandardToLLVM/invalid.mlir
mlir/test/Dialect/Affine/loop-unswitch.mlir
mlir/test/Dialect/Affine/simplify-affine-structures.mlir
mlir/test/Dialect/GPU/async-region.mlir
mlir/test/Dialect/LLVMIR/invalid.mlir
mlir/test/Dialect/Linalg/bufferize.mlir
mlir/test/Dialect/SCF/canonicalize.mlir
mlir/test/Dialect/SPIRV/types.mlir
mlir/test/Dialect/Standard/func-bufferize.mlir
mlir/test/IR/affine-map.mlir
mlir/test/IR/core-ops.mlir
mlir/test/IR/invalid-func-op.mlir
mlir/test/IR/locations.mlir
mlir/test/IR/parser.mlir
mlir/test/IR/test-func-erase-result.mlir
mlir/test/IR/test-func-set-type.mlir
mlir/test/IR/test-symbol-rauw.mlir
mlir/test/IR/test-symbol-uses.mlir
mlir/test/IR/traits.mlir
mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir
mlir/test/Pass/dynamic-pipeline-nested.mlir
mlir/test/Transforms/buffer-results-to-out-params.mlir
mlir/test/Transforms/decompose-call-graph-types.mlir
mlir/test/Transforms/inlining.mlir
mlir/test/Transforms/normalize-memrefs.mlir
mlir/test/Transforms/sccp-callgraph.mlir
mlir/test/Transforms/sccp.mlir
mlir/test/Transforms/test-convert-call-op.mlir
mlir/test/Transforms/test-legalizer.mlir
mlir/test/Transforms/test-symbol-dce.mlir
mlir/test/mlir-cpu-runner/async-group.mlir
mlir/test/mlir-cpu-runner/async.mlir
mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
mlir/test/mlir-cpu-runner/global_memref.mlir
mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
mlir/test/mlir-cpu-runner/memref_reshape.mlir
mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
mlir/test/mlir-cpu-runner/unranked_memref.mlir
mlir/test/mlir-cpu-runner/utils.mlir
mlir/test/mlir-cuda-runner/all-reduce-and.mlir
mlir/test/mlir-cuda-runner/all-reduce-max.mlir
mlir/test/mlir-cuda-runner/all-reduce-min.mlir
mlir/test/mlir-cuda-runner/all-reduce-op.mlir
mlir/test/mlir-cuda-runner/all-reduce-or.mlir
mlir/test/mlir-cuda-runner/all-reduce-region.mlir
mlir/test/mlir-cuda-runner/all-reduce-xor.mlir
mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir
mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir
mlir/test/mlir-cuda-runner/shuffle.mlir
mlir/test/mlir-cuda-runner/two-modules.mlir
mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir
mlir/test/mlir-rocm-runner/vecadd.mlir
mlir/test/mlir-rocm-runner/vector-transferops.mlir
mlir/test/mlir-spirv-cpu-runner/double.mlir
mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
mlir/test/mlir-vulkan-runner/addf.mlir
mlir/test/mlir-vulkan-runner/addi.mlir
mlir/test/mlir-vulkan-runner/addi8.mlir
mlir/test/mlir-vulkan-runner/mulf.mlir
mlir/test/mlir-vulkan-runner/subf.mlir
mlir/test/mlir-vulkan-runner/time.mlir
mlir/unittests/Pass/AnalysisManagerTest.cpp
mlir/unittests/Pass/PassManagerTest.cpp
Removed:
################################################################################
diff --git a/mlir/docs/SymbolsAndSymbolTables.md b/mlir/docs/SymbolsAndSymbolTables.md
index d7bcfa46d4e5..90e0fab47c2c 100644
--- a/mlir/docs/SymbolsAndSymbolTables.md
+++ b/mlir/docs/SymbolsAndSymbolTables.md
@@ -35,7 +35,7 @@ link, or use, to the symbol. An example of a `Symbol` operation is
[referred to](#referencing-a-symbol) by operations like
[`std.call`](Dialects/Standard.md#call).
-### Defining a Symbol
+### Defining or declaring a Symbol
A `Symbol` operation should use the `SymbolOpInterface` interface to provide the
necessary verification and accessors; it also supports
@@ -52,6 +52,9 @@ have the following properties:
* No SSA results
- Intermixing the
diff erent ways to `use` an operation quickly becomes
unwieldy and
diff icult to analyze.
+* Whether this operation is a declaration or definition (`isDeclaration`)
+ - Declarations do not define a new symbol but reference a symbol defined
+ outside the visible IR.
## Symbol Table
@@ -182,7 +185,10 @@ symbol has one of the following visibilities:
* Public (Default)
- The symbol may be referenced from outside of the visible IR. We cannot
- assume that all of the uses of this symbol are observable.
+ assume that all of the uses of this symbol are observable. If the
+ operation declares a symbol (as opposed to defining it), public
+ visibility is not allowed because symbol declarations are not intended
+ to be used from outside the visible IR.
* Private
diff --git a/mlir/include/mlir/IR/Function.h b/mlir/include/mlir/IR/Function.h
index 3ea546cd52a3..3ff2700a3380 100644
--- a/mlir/include/mlir/IR/Function.h
+++ b/mlir/include/mlir/IR/Function.h
@@ -85,6 +85,12 @@ class FuncOp
/// Returns the results types that the callable region produces when executed.
ArrayRef<Type> getCallableResults() { return getType().getResults(); }
+ //===--------------------------------------------------------------------===//
+ // SymbolOpInterface Methods
+ //===--------------------------------------------------------------------===//
+
+ bool isDeclaration() { return isExternal(); }
+
private:
// This trait needs access to the hooks defined below.
friend class OpTrait::FunctionLike<FuncOp>;
diff --git a/mlir/include/mlir/IR/SymbolInterfaces.td b/mlir/include/mlir/IR/SymbolInterfaces.td
index a997acee07f7..83cd6bdbd861 100644
--- a/mlir/include/mlir/IR/SymbolInterfaces.td
+++ b/mlir/include/mlir/IR/SymbolInterfaces.td
@@ -148,6 +148,16 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
return getVisibility() != ::mlir::SymbolTable::Visibility::Public;
}]
>,
+ InterfaceMethod<[{
+ Returns true if this operation is a declaration of a symbol (as opposed
+ to a definition).
+ }],
+ "bool", "isDeclaration", (ins), [{}],
+ /*defaultImplementation=*/[{
+ // By default, assume that the operation defines a symbol.
+ return false;
+ }]
+ >,
];
let verify = [{
@@ -157,7 +167,12 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
if(!concreteOp.getAttr(::mlir::SymbolTable::getSymbolAttrName()))
return success();
}
- return ::mlir::detail::verifySymbol($_op);
+ if (::mlir::failed(::mlir::detail::verifySymbol($_op)))
+ return ::mlir::failure();
+ if (concreteOp.isDeclaration() && concreteOp.isPublic())
+ return concreteOp.emitOpError("symbol declaration cannot have public "
+ "visibility");
+ return success();
}];
let extraClassDeclaration = [{
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/matmul-vs-matvec.mlir b/mlir/integration_test/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
index 9157f9abaab9..7aa875a3cf53 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
@@ -3,7 +3,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
func @matmul(%A: memref<?x?xf32>, %B: memref<?x?xf32>) -> (memref<?x?xf32>) {
%c0 = constant 0 : index
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/rank-reducing-subview.mlir b/mlir/integration_test/Dialect/Linalg/CPU/rank-reducing-subview.mlir
index ceffd6f79d23..2cfe02b7d88b 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/rank-reducing-subview.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/rank-reducing-subview.mlir
@@ -3,7 +3,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
func @main() {
%c0 = constant 0 : index
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-call.mlir
index 7cc0875b3353..c67308fb6d8a 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns a 1-D buffer of size %s1 filled with the value %f
func @alloc_1d_filled_f32(%s1 : index, %f : f32) -> memref<?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-ncw-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-ncw-call.mlir
index 7f90ac675f72..db97bc40538c 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-ncw-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-ncw-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 3-D buffer of size (%s1, %s2, %s3) filled with the value %f
func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref<?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-nwc-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-nwc-call.mlir
index 3eb0959ddda1..808763002018 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-nwc-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-1d-nwc-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 3-D buffer of size (%s1, %s2, %s3) filled with the value %f
func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref<?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-call.mlir
index 787cbf5d268b..f85471ce2324 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns a 2-D buffer of size (%s1, %s2) filled with the value %f
func @alloc_2d_filled_f32(%s1 : index, %s2 : index, %f : f32) -> memref<?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nchw-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nchw-call.mlir
index c6236db6a05a..d18a6becbcf3 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nchw-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nchw-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 4-D buffer of size (%s1, %s2, %s3, %s4) filled with the value %f
func @alloc_4d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %f : f32) -> memref<?x?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nhwc-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nhwc-call.mlir
index 3213b7dc5fe2..a3d8cdc0524e 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nhwc-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-2d-nhwc-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 4-D buffer of size (%s1, %s2, %s3, %s4) filled with the value %f
func @alloc_4d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %f : f32) -> memref<?x?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-call.mlir
index 8020f3ac017f..daa81d56c168 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 3-D buffer of size (%s1, %s2, %s3) filled with the value %f
func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref<?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ncdhw-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ncdhw-call.mlir
index 830b5402c2a4..df5838cf2bfa 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ncdhw-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ncdhw-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 5-D buffer of size (%s1, %s2, %s3, %s4, %s5) filled with the value %f
func @alloc_5d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %s5 : index, %f : f32) -> memref<?x?x?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ndhwc-call.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ndhwc-call.mlir
index 0b25ea09157c..ddece94e114a 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ndhwc-call.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-conv-3d-ndhwc-call.mlir
@@ -20,7 +20,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
// Creates and returns 5-D buffer of size (%s1, %s2, %s3, %s4, %s5) filled with the value %f
func @alloc_5d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %s5 : index, %f : f32) -> memref<?x?x?x?x?xf32> {
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-elementwise.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-elementwise.mlir
index 08bb81246793..81fcc70e91be 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-elementwise.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-elementwise.mlir
@@ -16,4 +16,4 @@ func @main() {
return
}
-func @print_memref_f32(%ptr : tensor<*xf32>)
+func private @print_memref_f32(%ptr : tensor<*xf32>)
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-e2e.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-e2e.mlir
index 67e490009194..a6f24e45dbc1 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-e2e.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-e2e.mlir
@@ -31,4 +31,4 @@ func @main() {
// Note that this is skipping a step and we would need at least some function
// attribute to declare that this conversion is valid (e.g. when we statically
// know that things will play nicely at the C ABI boundary).
-func @print_memref_f32(%ptr : tensor<*xf32>)
+func private @print_memref_f32(%ptr : tensor<*xf32>)
diff --git a/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-matmul.mlir b/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-matmul.mlir
index 7a828b64b731..4bcb3acdc162 100644
--- a/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-matmul.mlir
+++ b/mlir/integration_test/Dialect/Linalg/CPU/test-tensor-matmul.mlir
@@ -32,4 +32,4 @@ func @main() {
return
}
-func @print_memref_f32(%ptr : tensor<*xf32>)
+func private @print_memref_f32(%ptr : tensor<*xf32>)
diff --git a/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir b/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir
index 38cbabc32998..b8f4045495ff 100644
--- a/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir
+++ b/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir
@@ -6,7 +6,7 @@
#map0 = affine_map<(d0, d1) -> (d1, d0)>
#map1 = affine_map<(d0, d1) -> (d1)>
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
func @alloc_2d_filled_f32(%arg0: index, %arg1: index) -> memref<?x?xf32> {
%c0 = constant 0 : index
diff --git a/mlir/integration_test/Dialect/Vector/CPU/test-vector-distribute.mlir b/mlir/integration_test/Dialect/Vector/CPU/test-vector-distribute.mlir
index b83b1f653900..fb4b1029c790 100644
--- a/mlir/integration_test/Dialect/Vector/CPU/test-vector-distribute.mlir
+++ b/mlir/integration_test/Dialect/Vector/CPU/test-vector-distribute.mlir
@@ -13,7 +13,7 @@
// RUN: mlir-opt %s -test-vector-to-forloop | FileCheck %s -check-prefix=TRANSFORM
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
func @alloc_1d_filled_inc_f32(%arg0: index, %arg1: f32) -> memref<?xf32> {
%c0 = constant 0 : index
diff --git a/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir b/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
index 56c392e8133b..b03c5b111d98 100644
--- a/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
+++ b/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
@@ -8,10 +8,10 @@
// RUN: FileCheck %s
module {
- func @openMatrix(!llvm.ptr<i8>, memref<index>, memref<index>, memref<index>) -> ()
- func @readMatrixItem(memref<index>, memref<index>, memref<f64>) -> ()
- func @closeMatrix() -> ()
- func @getMatrix(index) -> (!llvm.ptr<i8>)
+ func private @openMatrix(!llvm.ptr<i8>, memref<index>, memref<index>, memref<index>) -> ()
+ func private @readMatrixItem(memref<index>, memref<index>, memref<f64>) -> ()
+ func private @closeMatrix() -> ()
+ func private @getMatrix(index) -> (!llvm.ptr<i8>)
func @entry() {
%d0 = constant 0.0 : f64
diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
index f0bd72028184..8195e17fe0c3 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
+++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
@@ -109,7 +109,7 @@ static void addAsyncRuntimeApiDeclarations(ModuleOp module) {
auto addFuncDecl = [&](StringRef name, FunctionType type) {
if (module.lookupSymbol(name))
return;
- builder.create<FuncOp>(module.getLoc(), name, type);
+ builder.create<FuncOp>(module.getLoc(), name, type).setPrivate();
};
MLIRContext *ctx = module.getContext();
diff --git a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
index bfc8b6d6dec4..f0fff751c91b 100644
--- a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
+++ b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
@@ -123,9 +123,8 @@ LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::declareVulkanLaunchFunc(
}
// Declare vulkan launch function.
- builder.create<FuncOp>(
- loc, kVulkanLaunch,
- FunctionType::get(vulkanLaunchTypes, {}, loc->getContext()));
+ auto funcType = FunctionType::get(vulkanLaunchTypes, {}, loc->getContext());
+ builder.create<FuncOp>(loc, kVulkanLaunch, funcType).setPrivate();
return success();
}
diff --git a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
index 5037f50b1f7c..5bb1db46e4af 100644
--- a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
+++ b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
@@ -77,6 +77,7 @@ static FlatSymbolRefAttr getLibraryCallSymbolRef(Operation *op,
// corresponding `_mlir_ciface_xxx` interface so that external libraries see
// a normalized ABI. This interface is added during std to llvm conversion.
funcOp.setAttr("llvm.emit_c_interface", UnitAttr::get(op->getContext()));
+ funcOp.setPrivate();
return fnNameAttr;
}
diff --git a/mlir/test/Analysis/test-callgraph.mlir b/mlir/test/Analysis/test-callgraph.mlir
index bb5ba6074200..1befa5338100 100644
--- a/mlir/test/Analysis/test-callgraph.mlir
+++ b/mlir/test/Analysis/test-callgraph.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -test-print-callgraph -split-input-file 2>&1 | FileCheck %s
+// RUN: mlir-opt %s -test-print-callgraph -split-input-file -allow-unregistered-dialect 2>&1 | FileCheck %s
// CHECK-LABEL: Testing : "simple"
module attributes {test.name = "simple"} {
@@ -8,7 +8,7 @@ module attributes {test.name = "simple"} {
return
}
- func @func_b()
+ func private @func_b()
// CHECK: Node{{.*}}func_c
// CHECK-NEXT: Call-Edge{{.*}}External-Node
diff --git a/mlir/test/Conversion/AffineToStandard/lower-affine.mlir b/mlir/test/Conversion/AffineToStandard/lower-affine.mlir
index 7aac76b870b7..f89d913cb64a 100644
--- a/mlir/test/Conversion/AffineToStandard/lower-affine.mlir
+++ b/mlir/test/Conversion/AffineToStandard/lower-affine.mlir
@@ -5,7 +5,7 @@ func @empty() {
return // CHECK: return
} // CHECK: }
-func @body(index) -> ()
+func private @body(index) -> ()
// Simple loops are properly converted.
// CHECK-LABEL: func @simple_loop
@@ -26,9 +26,9 @@ func @simple_loop() {
/////////////////////////////////////////////////////////////////////
-func @pre(index) -> ()
-func @body2(index, index) -> ()
-func @post(index) -> ()
+func private @pre(index) -> ()
+func private @body2(index, index) -> ()
+func private @post(index) -> ()
// CHECK-LABEL: func @imperfectly_nested_loops
// CHECK-NEXT: %[[c0:.*]] = constant 0 : index
@@ -59,8 +59,8 @@ func @imperfectly_nested_loops() {
/////////////////////////////////////////////////////////////////////
-func @mid(index) -> ()
-func @body3(index, index) -> ()
+func private @mid(index) -> ()
+func private @body3(index, index) -> ()
// CHECK-LABEL: func @more_imperfectly_nested_loops
// CHECK-NEXT: %[[c0:.*]] = constant 0 : index
@@ -123,7 +123,7 @@ func @affine_apply_loops_shorthand(%N : index) {
/////////////////////////////////////////////////////////////////////
-func @get_idx() -> (index)
+func private @get_idx() -> (index)
#set1 = affine_set<(d0) : (20 - d0 >= 0)>
#set2 = affine_set<(d0) : (d0 - 10 >= 0)>
diff --git a/mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir b/mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir
index c3f1325a549b..7e0671b93607 100644
--- a/mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir
+++ b/mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir
@@ -314,7 +314,7 @@ func @nested_for_yield(%arg0 : index, %arg1 : index, %arg2 : index) -> f32 {
return %r : f32
}
-func @generate() -> i64
+func private @generate() -> i64
// CHECK-LABEL: @simple_parallel_reduce_loop
// CHECK-SAME: %[[LB:.*]]: index, %[[UB:.*]]: index, %[[STEP:.*]]: index, %[[INIT:.*]]: f32
diff --git a/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir b/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
index 4c318c14a95e..238cd39577b8 100644
--- a/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
@@ -10,7 +10,7 @@
// CHECK-LABEL: @external
// CHECK: %[[ALLOC0:.*]]: !llvm.ptr<float>, %[[ALIGN0:.*]]: !llvm.ptr<float>, %[[OFFSET0:.*]]: !llvm.i64, %[[SIZE00:.*]]: !llvm.i64, %[[SIZE01:.*]]: !llvm.i64, %[[STRIDE00:.*]]: !llvm.i64, %[[STRIDE01:.*]]: !llvm.i64,
// CHECK: %[[ALLOC1:.*]]: !llvm.ptr<float>, %[[ALIGN1:.*]]: !llvm.ptr<float>, %[[OFFSET1:.*]]: !llvm.i64)
-func @external(%arg0: memref<?x?xf32>, %arg1: memref<f32>)
+func private @external(%arg0: memref<?x?xf32>, %arg1: memref<f32>)
// Populate the descriptor for arg0.
// CHECK: %[[DESC00:.*]] = llvm.mlir.undef : !llvm.struct<(ptr<float>, ptr<float>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: %[[DESC01:.*]] = llvm.insertvalue %arg0, %[[DESC00]][0]
@@ -47,7 +47,7 @@ func @external(%arg0: memref<?x?xf32>, %arg1: memref<f32>)
// Verify that the return value is not affected.
// CHECK-LABEL: @returner
// CHECK: -> !llvm.struct<(struct<(ptr<float>, ptr<float>, i64, array<2 x i64>, array<2 x i64>)>, struct<(ptr<float>, ptr<float>, i64)>)>
-func @returner() -> (memref<?x?xf32>, memref<f32>)
+func private @returner() -> (memref<?x?xf32>, memref<f32>)
// CHECK-LABEL: @caller
func @caller() {
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir b/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
index d2a88ed952f7..6d2419692750 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
@@ -1,30 +1,30 @@
// RUN: mlir-opt -convert-std-to-llvm %s | FileCheck %s
//CHECK: llvm.func @second_order_arg(!llvm.ptr<func<void ()>>)
-func @second_order_arg(%arg0 : () -> ())
+func private @second_order_arg(%arg0 : () -> ())
//CHECK: llvm.func @second_order_result() -> !llvm.ptr<func<void ()>>
-func @second_order_result() -> (() -> ())
+func private @second_order_result() -> (() -> ())
//CHECK: llvm.func @second_order_multi_result() -> !llvm.struct<(ptr<func<i32 ()>>, ptr<func<i64 ()>>, ptr<func<float ()>>)>
-func @second_order_multi_result() -> (() -> (i32), () -> (i64), () -> (f32))
+func private @second_order_multi_result() -> (() -> (i32), () -> (i64), () -> (f32))
//CHECK: llvm.func @third_order(!llvm.ptr<func<ptr<func<void ()>> (ptr<func<void ()>>)>>) -> !llvm.ptr<func<ptr<func<void ()>> (ptr<func<void ()>>)>>
-func @third_order(%arg0 : (() -> ()) -> (() -> ())) -> ((() -> ()) -> (() -> ()))
+func private @third_order(%arg0 : (() -> ()) -> (() -> ())) -> ((() -> ()) -> (() -> ()))
//CHECK: llvm.func @fifth_order_left(!llvm.ptr<func<void (ptr<func<void (ptr<func<void (ptr<func<void ()>>)>>)>>)>>)
-func @fifth_order_left(%arg0: (((() -> ()) -> ()) -> ()) -> ())
+func private @fifth_order_left(%arg0: (((() -> ()) -> ()) -> ()) -> ())
//CHECK: llvm.func @fifth_order_right(!llvm.ptr<func<ptr<func<ptr<func<ptr<func<void ()>> ()>> ()>> ()>>)
-func @fifth_order_right(%arg0: () -> (() -> (() -> (() -> ()))))
+func private @fifth_order_right(%arg0: () -> (() -> (() -> (() -> ()))))
// Check that memrefs are converted to argument packs if appear as function arguments.
// CHECK: llvm.func @memref_call_conv(!llvm.ptr<float>, !llvm.ptr<float>, !llvm.i64, !llvm.i64, !llvm.i64)
-func @memref_call_conv(%arg0: memref<?xf32>)
+func private @memref_call_conv(%arg0: memref<?xf32>)
// Same in nested functions.
// CHECK: llvm.func @memref_call_conv_nested(!llvm.ptr<func<void (ptr<float>, ptr<float>, i64, i64, i64)>>)
-func @memref_call_conv_nested(%arg0: (memref<?xf32>) -> ())
+func private @memref_call_conv_nested(%arg0: (memref<?xf32>) -> ())
//CHECK-LABEL: llvm.func @pass_through(%arg0: !llvm.ptr<func<void ()>>) -> !llvm.ptr<func<void ()>> {
func @pass_through(%arg0: () -> ()) -> (() -> ()) {
@@ -38,7 +38,7 @@ func @pass_through(%arg0: () -> ()) -> (() -> ()) {
}
// CHECK-LABEL: llvm.func @body(!llvm.i32)
-func @body(i32)
+func private @body(i32)
// CHECK-LABEL: llvm.func @indirect_const_call
// CHECK-SAME: (%[[ARG0:.*]]: !llvm.i32) {
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir b/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
index d9d93b7823b8..956e1fcf692b 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
@@ -389,7 +389,7 @@ func @static_memref_dim(%static : memref<42x32x15x13x27xf32>) {
// -----
// BAREPTR: llvm.func @foo(!llvm.ptr<i8>) -> !llvm.ptr<i8>
-func @foo(memref<10xi8>) -> memref<20xi8>
+func private @foo(memref<10xi8>) -> memref<20xi8>
// BAREPTR-LABEL: func @check_memref_func_call
// BAREPTR-SAME: %[[in:.*]]: !llvm.ptr<i8>) -> !llvm.ptr<i8>
@@ -415,7 +415,7 @@ func @check_memref_func_call(%in : memref<10xi8>) -> memref<20xi8> {
// -----
// BAREPTR: llvm.func @goo(!llvm.float) -> !llvm.float
-func @goo(f32) -> f32
+func private @goo(f32) -> f32
// BAREPTR-LABEL: func @check_scalar_func_call
// BAREPTR-SAME: %[[in:.*]]: !llvm.float)
@@ -431,8 +431,8 @@ func @check_scalar_func_call(%in : f32) {
// convention. Check that the conversion to the LLVM-IR dialect doesn't happen
// in the presence of unranked memrefs when using such a calling convention.
-// BAREPTR: func @hoo(memref<*xi8>) -> memref<*xi8>
-func @hoo(memref<*xi8>) -> memref<*xi8>
+// BAREPTR: func private @hoo(memref<*xi8>) -> memref<*xi8>
+func private @hoo(memref<*xi8>) -> memref<*xi8>
// BAREPTR-LABEL: func @check_unranked_memref_func_call(%{{.*}}: memref<*xi8>) -> memref<*xi8>
func @check_unranked_memref_func_call(%in: memref<*xi8>) -> memref<*xi8> {
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
index bb0363b1cba5..2dcc3114b4d0 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
@@ -9,8 +9,8 @@ func @empty() {
return
}
-// CHECK-LABEL: func @body(!llvm.i64)
-func @body(index)
+// CHECK-LABEL: llvm.func @body(!llvm.i64)
+func private @body(index)
// CHECK-LABEL: func @simple_loop() {
// CHECK32-LABEL: func @simple_loop() {
@@ -155,12 +155,12 @@ func @ml_caller() {
return
}
-// CHECK-LABEL: func @body_args(!llvm.i64) -> !llvm.i64
-// CHECK32-LABEL: func @body_args(!llvm.i32) -> !llvm.i32
-func @body_args(index) -> index
-// CHECK-LABEL: func @other(!llvm.i64, !llvm.i32) -> !llvm.i32
-// CHECK32-LABEL: func @other(!llvm.i32, !llvm.i32) -> !llvm.i32
-func @other(index, i32) -> i32
+// CHECK-LABEL: llvm.func @body_args(!llvm.i64) -> !llvm.i64
+// CHECK32-LABEL: llvm.func @body_args(!llvm.i32) -> !llvm.i32
+func private @body_args(index) -> index
+// CHECK-LABEL: llvm.func @other(!llvm.i64, !llvm.i32) -> !llvm.i32
+// CHECK32-LABEL: llvm.func @other(!llvm.i32, !llvm.i32) -> !llvm.i32
+func private @other(index, i32) -> i32
// CHECK-LABEL: func @func_args(%arg0: !llvm.i32, %arg1: !llvm.i32) -> !llvm.i32 {
// CHECK-NEXT: {{.*}} = llvm.mlir.constant(0 : i32) : !llvm.i32
@@ -235,17 +235,17 @@ func @func_args(i32, i32) -> i32 {
return %7 : i32
}
-// CHECK-LABEL: func @pre(!llvm.i64)
-// CHECK32-LABEL: func @pre(!llvm.i32)
-func @pre(index)
+// CHECK-LABEL: llvm.func @pre(!llvm.i64)
+// CHECK32-LABEL: llvm.func @pre(!llvm.i32)
+func private @pre(index)
-// CHECK-LABEL: func @body2(!llvm.i64, !llvm.i64)
-// CHECK32-LABEL: func @body2(!llvm.i32, !llvm.i32)
-func @body2(index, index)
+// CHECK-LABEL: llvm.func @body2(!llvm.i64, !llvm.i64)
+// CHECK32-LABEL: llvm.func @body2(!llvm.i32, !llvm.i32)
+func private @body2(index, index)
-// CHECK-LABEL: func @post(!llvm.i64)
-// CHECK32-LABEL: func @post(!llvm.i32)
-func @post(index)
+// CHECK-LABEL: llvm.func @post(!llvm.i64)
+// CHECK32-LABEL: llvm.func @post(!llvm.i32)
+func private @post(index)
// CHECK-LABEL: func @imperfectly_nested_loops() {
// CHECK-NEXT: llvm.br ^bb1
@@ -320,11 +320,11 @@ func @imperfectly_nested_loops() {
return
}
-// CHECK-LABEL: func @mid(!llvm.i64)
-func @mid(index)
+// CHECK-LABEL: llvm.func @mid(!llvm.i64)
+func private @mid(index)
-// CHECK-LABEL: func @body3(!llvm.i64, !llvm.i64)
-func @body3(index, index)
+// CHECK-LABEL: llvm.func @body3(!llvm.i64, !llvm.i64)
+func private @body3(index, index)
// A complete function transformation check.
// CHECK-LABEL: func @more_imperfectly_nested_loops() {
@@ -423,22 +423,22 @@ func @more_imperfectly_nested_loops() {
return
}
-// CHECK-LABEL: func @get_i64() -> !llvm.i64
-func @get_i64() -> (i64)
-// CHECK-LABEL: func @get_f32() -> !llvm.float
-func @get_f32() -> (f32)
-// CHECK-LABEL: func @get_c16() -> !llvm.struct<(half, half)>
-func @get_c16() -> (complex<f16>)
-// CHECK-LABEL: func @get_c32() -> !llvm.struct<(float, float)>
-func @get_c32() -> (complex<f32>)
-// CHECK-LABEL: func @get_c64() -> !llvm.struct<(double, double)>
-func @get_c64() -> (complex<f64>)
-// CHECK-LABEL: func @get_memref() -> !llvm.struct<(ptr<float>, ptr<float>, i64, array<4 x i64>, array<4 x i64>)>
-// CHECK32-LABEL: func @get_memref() -> !llvm.struct<(ptr<float>, ptr<float>, i32, array<4 x i32>, array<4 x i32>)>
-func @get_memref() -> (memref<42x?x10x?xf32>)
-
-// CHECK-LABEL: func @multireturn() -> !llvm.struct<(i64, float, struct<(ptr<float>, ptr<float>, i64, array<4 x i64>, array<4 x i64>)>)> {
-// CHECK32-LABEL: func @multireturn() -> !llvm.struct<(i64, float, struct<(ptr<float>, ptr<float>, i32, array<4 x i32>, array<4 x i32>)>)> {
+// CHECK-LABEL: llvm.func @get_i64() -> !llvm.i64
+func private @get_i64() -> (i64)
+// CHECK-LABEL: llvm.func @get_f32() -> !llvm.float
+func private @get_f32() -> (f32)
+// CHECK-LABEL: llvm.func @get_c16() -> !llvm.struct<(half, half)>
+func private @get_c16() -> (complex<f16>)
+// CHECK-LABEL: llvm.func @get_c32() -> !llvm.struct<(float, float)>
+func private @get_c32() -> (complex<f32>)
+// CHECK-LABEL: llvm.func @get_c64() -> !llvm.struct<(double, double)>
+func private @get_c64() -> (complex<f64>)
+// CHECK-LABEL: llvm.func @get_memref() -> !llvm.struct<(ptr<float>, ptr<float>, i64, array<4 x i64>, array<4 x i64>)>
+// CHECK32-LABEL: llvm.func @get_memref() -> !llvm.struct<(ptr<float>, ptr<float>, i32, array<4 x i32>, array<4 x i32>)>
+func private @get_memref() -> (memref<42x?x10x?xf32>)
+
+// CHECK-LABEL: llvm.func @multireturn() -> !llvm.struct<(i64, float, struct<(ptr<float>, ptr<float>, i64, array<4 x i64>, array<4 x i64>)>)> {
+// CHECK32-LABEL: llvm.func @multireturn() -> !llvm.struct<(i64, float, struct<(ptr<float>, ptr<float>, i32, array<4 x i32>, array<4 x i32>)>)> {
func @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) {
^bb0:
// CHECK-NEXT: {{.*}} = llvm.call @get_i64() : () -> !llvm.i64
@@ -464,8 +464,8 @@ func @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) {
}
-// CHECK-LABEL: func @multireturn_caller() {
-// CHECK32-LABEL: func @multireturn_caller() {
+// CHECK-LABEL: llvm.func @multireturn_caller() {
+// CHECK32-LABEL: llvm.func @multireturn_caller() {
func @multireturn_caller() {
^bb0:
// CHECK-NEXT: {{.*}} = llvm.call @multireturn() : () -> !llvm.struct<(i64, float, struct<(ptr<float>, ptr<float>, i64, array<4 x i64>, array<4 x i64>)>)>
@@ -487,7 +487,7 @@ func @multireturn_caller() {
return
}
-// CHECK-LABEL: func @vector_ops(%arg0: !llvm.vec<4 x float>, %arg1: !llvm.vec<4 x i1>, %arg2: !llvm.vec<4 x i64>, %arg3: !llvm.vec<4 x i64>) -> !llvm.vec<4 x float> {
+// CHECK-LABEL: llvm.func @vector_ops(%arg0: !llvm.vec<4 x float>, %arg1: !llvm.vec<4 x i1>, %arg2: !llvm.vec<4 x i64>, %arg3: !llvm.vec<4 x i64>) -> !llvm.vec<4 x float> {
func @vector_ops(%arg0: vector<4xf32>, %arg1: vector<4xi1>, %arg2: vector<4xi64>, %arg3: vector<4xi64>) -> vector<4xf32> {
// CHECK-NEXT: %0 = llvm.mlir.constant(dense<4.200000e+01> : vector<4xf32>) : !llvm.vec<4 x float>
%0 = constant dense<42.> : vector<4xf32>
diff --git a/mlir/test/Conversion/StandardToLLVM/invalid.mlir b/mlir/test/Conversion/StandardToLLVM/invalid.mlir
index 40acf4bc9d49..a8513a805d9e 100644
--- a/mlir/test/Conversion/StandardToLLVM/invalid.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/invalid.mlir
@@ -33,8 +33,8 @@ func @mlir_cast_to_llvm_vec(%0 : vector<1x1xf32>) -> !llvm.vec<1 x float> {
// -----
// Should not crash on unsupported types in function signatures.
-func @unsupported_signature() -> tensor<10 x i32>
+func private @unsupported_signature() -> tensor<10 x i32>
// -----
-func @partially_supported_signature() -> (vector<10 x i32>, tensor<10 x i32>)
+func private @partially_supported_signature() -> (vector<10 x i32>, tensor<10 x i32>)
diff --git a/mlir/test/Dialect/Affine/loop-unswitch.mlir b/mlir/test/Dialect/Affine/loop-unswitch.mlir
index 0080e379427f..bbeb90dc4602 100644
--- a/mlir/test/Dialect/Affine/loop-unswitch.mlir
+++ b/mlir/test/Dialect/Affine/loop-unswitch.mlir
@@ -18,7 +18,7 @@ func @if_else_imperfect(%A : memref<100xi32>, %B : memref<100xi32>, %v : i32) {
}
return
}
-func @external()
+func private @external()
// CHECK: affine.for %[[I:.*]] = 0 to 100 {
// CHECK-NEXT: affine.store %{{.*}}, %[[A]][%[[I]]]
@@ -40,10 +40,10 @@ func @external()
// -----
-func @foo()
-func @bar()
-func @abc()
-func @xyz()
+func private @foo()
+func private @bar()
+func private @abc()
+func private @xyz()
// CHECK-LABEL: func @if_then_perfect
func @if_then_perfect(%A : memref<100xi32>, %v : i32) {
@@ -255,4 +255,4 @@ func @multiple_if(%N : index) {
// CHECK-NEXT: }
// CHECK-NEXT: return
-func @external()
+func private @external()
diff --git a/mlir/test/Dialect/Affine/simplify-affine-structures.mlir b/mlir/test/Dialect/Affine/simplify-affine-structures.mlir
index 664c6c0e5284..dad930cef061 100644
--- a/mlir/test/Dialect/Affine/simplify-affine-structures.mlir
+++ b/mlir/test/Dialect/Affine/simplify-affine-structures.mlir
@@ -5,7 +5,7 @@
// CHECK-DAG: #[[$SET_7_11:.*]] = affine_set<(d0, d1) : (d0 * 7 + d1 * 5 + 88 == 0, d0 * 5 - d1 * 11 + 60 == 0, d0 * 11 + d1 * 7 - 24 == 0, d0 * 7 + d1 * 5 + 88 == 0)>
// An external function that we will use in bodies to avoid DCE.
-func @external() -> ()
+func private @external() -> ()
// CHECK-LABEL: func @test_gaussian_elimination_empty_set0() {
func @test_gaussian_elimination_empty_set0() {
@@ -236,7 +236,7 @@ func @test_empty_set(%N : index) {
// -----
// An external function that we will use in bodies to avoid DCE.
-func @external() -> ()
+func private @external() -> ()
// CHECK-DAG: #[[$SET:.*]] = affine_set<()[s0] : (s0 >= 0, -s0 + 50 >= 0)
// CHECK-DAG: #[[$EMPTY_SET:.*]] = affine_set<() : (1 == 0)
diff --git a/mlir/test/Dialect/GPU/async-region.mlir b/mlir/test/Dialect/GPU/async-region.mlir
index 8e0b81f57e1f..32e613e773fe 100644
--- a/mlir/test/Dialect/GPU/async-region.mlir
+++ b/mlir/test/Dialect/GPU/async-region.mlir
@@ -7,7 +7,7 @@ module attributes {gpu.container_module} {
gpu.func @kernel() kernel { gpu.return }
}
- func @foo() -> ()
+ func private @foo() -> ()
// CHECK-LABEL:func @async(%{{.*}}: index)
func @async(%sz : index) {
diff --git a/mlir/test/Dialect/LLVMIR/invalid.mlir b/mlir/test/Dialect/LLVMIR/invalid.mlir
index f7d19bc66c8d..9117f6aee3f0 100644
--- a/mlir/test/Dialect/LLVMIR/invalid.mlir
+++ b/mlir/test/Dialect/LLVMIR/invalid.mlir
@@ -153,7 +153,7 @@ func @call_unknown_symbol() {
// -----
-func @standard_func_callee()
+func private @standard_func_callee()
func @call_non_llvm() {
// expected-error at +1 {{'llvm.call' op 'standard_func_callee' does not reference a valid LLVM function}}
diff --git a/mlir/test/Dialect/Linalg/bufferize.mlir b/mlir/test/Dialect/Linalg/bufferize.mlir
index 866ded2fbe0e..5a0e4e86eaa3 100644
--- a/mlir/test/Dialect/Linalg/bufferize.mlir
+++ b/mlir/test/Dialect/Linalg/bufferize.mlir
@@ -135,7 +135,7 @@ func @generic_with_init_tensor(%arg0: tensor<2x3x4xvector<3x4xi4>>,
// CHECK-DAG: #[[$MAP0:[0-9a-z]*]] = affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + s0 + d1)>
// CHECK-DAG: #[[$MAP1:[0-9a-z]*]] = affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + s0 + d1 * 2)>
-func @make_index() -> index
+func private @make_index() -> index
// CHECK-LABEL: func @bufferize_subtensor(
// CHECK-SAME: %[[T:[0-9a-z]*]]: tensor<?x?xf32>
@@ -168,7 +168,7 @@ func @bufferize_subtensor(%t : tensor<?x?xf32>) -> (tensor<2x3xf32>, tensor<2x?x
// CHECK-DAG: #[[$MAP0:[0-9a-z]*]] = affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + s0 + d1)>
// CHECK-DAG: #[[$MAP1:[0-9a-z]*]] = affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + s0 + d1 * 2)>
-func @make_index() -> index
+func private @make_index() -> index
// CHECK-LABEL: func @bufferize_subtensor_insert(
// CHECK-SAME: %[[T:[0-9a-z]*]]: tensor<?x?xf32>
diff --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir
index bd91f3bde403..dd44e3d2933a 100644
--- a/mlir/test/Dialect/SCF/canonicalize.mlir
+++ b/mlir/test/Dialect/SCF/canonicalize.mlir
@@ -114,7 +114,7 @@ func @nested_unused() -> (index) {
// -----
-func @side_effect() {}
+func private @side_effect() {}
func @all_unused() {
%c0 = constant 0 : index
%c1 = constant 1 : index
@@ -140,7 +140,7 @@ func @all_unused() {
// -----
-func @make_i32() -> i32
+func private @make_i32() -> i32
func @for_yields_2(%lb : index, %ub : index, %step : index) -> i32 {
%a = call @make_i32() : () -> (i32)
diff --git a/mlir/test/Dialect/SPIRV/types.mlir b/mlir/test/Dialect/SPIRV/types.mlir
index ebd120a10bf9..7b96f3dd2232 100644
--- a/mlir/test/Dialect/SPIRV/types.mlir
+++ b/mlir/test/Dialect/SPIRV/types.mlir
@@ -6,84 +6,84 @@
// ArrayType
//===----------------------------------------------------------------------===//
-// CHECK: func @scalar_array_type(!spv.array<16 x f32>, !spv.array<8 x i32>)
-func @scalar_array_type(!spv.array<16xf32>, !spv.array<8 x i32>) -> ()
+// CHECK: func private @scalar_array_type(!spv.array<16 x f32>, !spv.array<8 x i32>)
+func private @scalar_array_type(!spv.array<16xf32>, !spv.array<8 x i32>) -> ()
-// CHECK: func @vector_array_type(!spv.array<32 x vector<4xf32>>)
-func @vector_array_type(!spv.array< 32 x vector<4xf32> >) -> ()
+// CHECK: func private @vector_array_type(!spv.array<32 x vector<4xf32>>)
+func private @vector_array_type(!spv.array< 32 x vector<4xf32> >) -> ()
-// CHECK: func @array_type_stride(!spv.array<4 x !spv.array<4 x f32, stride=4>, stride=128>)
-func @array_type_stride(!spv.array< 4 x !spv.array<4 x f32, stride=4>, stride = 128>) -> ()
+// CHECK: func private @array_type_stride(!spv.array<4 x !spv.array<4 x f32, stride=4>, stride=128>)
+func private @array_type_stride(!spv.array< 4 x !spv.array<4 x f32, stride=4>, stride = 128>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
-func @missing_left_angle_bracket(!spv.array 4xf32>) -> ()
+func private @missing_left_angle_bracket(!spv.array 4xf32>) -> ()
// -----
// expected-error @+1 {{expected single integer for array element count}}
-func @missing_count(!spv.array<f32>) -> ()
+func private @missing_count(!spv.array<f32>) -> ()
// -----
// expected-error @+1 {{expected 'x' in dimension list}}
-func @missing_x(!spv.array<4 f32>) -> ()
+func private @missing_x(!spv.array<4 f32>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
-func @missing_element_type(!spv.array<4x>) -> ()
+func private @missing_element_type(!spv.array<4x>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
-func @cannot_parse_type(!spv.array<4xblabla>) -> ()
+func private @cannot_parse_type(!spv.array<4xblabla>) -> ()
// -----
// expected-error @+1 {{expected single integer for array element count}}
-func @more_than_one_dim(!spv.array<4x3xf32>) -> ()
+func private @more_than_one_dim(!spv.array<4x3xf32>) -> ()
// -----
// expected-error @+1 {{only 1-D vector allowed but found 'vector<4x3xf32>'}}
-func @non_1D_vector(!spv.array<4xvector<4x3xf32>>) -> ()
+func private @non_1D_vector(!spv.array<4xvector<4x3xf32>>) -> ()
// -----
// expected-error @+1 {{cannot use 'tensor<4xf32>' to compose SPIR-V types}}
-func @tensor_type(!spv.array<4xtensor<4xf32>>) -> ()
+func private @tensor_type(!spv.array<4xtensor<4xf32>>) -> ()
// -----
// expected-error @+1 {{cannot use 'bf16' to compose SPIR-V types}}
-func @bf16_type(!spv.array<4xbf16>) -> ()
+func private @bf16_type(!spv.array<4xbf16>) -> ()
// -----
// expected-error @+1 {{only 1/8/16/32/64-bit integer type allowed but found 'i256'}}
-func @i256_type(!spv.array<4xi256>) -> ()
+func private @i256_type(!spv.array<4xi256>) -> ()
// -----
// expected-error @+1 {{cannot use 'index' to compose SPIR-V types}}
-func @index_type(!spv.array<4xindex>) -> ()
+func private @index_type(!spv.array<4xindex>) -> ()
// -----
// expected-error @+1 {{cannot use '!llvm.i32' to compose SPIR-V types}}
-func @llvm_type(!spv.array<4x!llvm.i32>) -> ()
+func private @llvm_type(!spv.array<4x!llvm.i32>) -> ()
// -----
// expected-error @+1 {{ArrayStride must be greater than zero}}
-func @array_type_zero_stride(!spv.array<4xi32, stride=0>) -> ()
+func private @array_type_zero_stride(!spv.array<4xi32, stride=0>) -> ()
// -----
// expected-error @+1 {{expected array length greater than 0}}
-func @array_type_zero_length(!spv.array<0xf32>) -> ()
+func private @array_type_zero_length(!spv.array<0xf32>) -> ()
// -----
@@ -92,33 +92,33 @@ func @array_type_zero_length(!spv.array<0xf32>) -> ()
//===----------------------------------------------------------------------===//
// CHECK: @bool_ptr_type(!spv.ptr<i1, Uniform>)
-func @bool_ptr_type(!spv.ptr<i1, Uniform>) -> ()
+func private @bool_ptr_type(!spv.ptr<i1, Uniform>) -> ()
// CHECK: @scalar_ptr_type(!spv.ptr<f32, Uniform>)
-func @scalar_ptr_type(!spv.ptr<f32, Uniform>) -> ()
+func private @scalar_ptr_type(!spv.ptr<f32, Uniform>) -> ()
// CHECK: @vector_ptr_type(!spv.ptr<vector<4xi32>, PushConstant>)
-func @vector_ptr_type(!spv.ptr<vector<4xi32>,PushConstant>) -> ()
+func private @vector_ptr_type(!spv.ptr<vector<4xi32>,PushConstant>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
-func @missing_left_angle_bracket(!spv.ptr f32, Uniform>) -> ()
+func private @missing_left_angle_bracket(!spv.ptr f32, Uniform>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @missing_comma(!spv.ptr<f32 Uniform>) -> ()
+func private @missing_comma(!spv.ptr<f32 Uniform>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
-func @missing_pointee_type(!spv.ptr<, Uniform>) -> ()
+func private @missing_pointee_type(!spv.ptr<, Uniform>) -> ()
// -----
// expected-error @+1 {{unknown storage class: SomeStorageClass}}
-func @unknown_storage_class(!spv.ptr<f32, SomeStorageClass>) -> ()
+func private @unknown_storage_class(!spv.ptr<f32, SomeStorageClass>) -> ()
// -----
@@ -126,34 +126,34 @@ func @unknown_storage_class(!spv.ptr<f32, SomeStorageClass>) -> ()
// RuntimeArrayType
//===----------------------------------------------------------------------===//
-// CHECK: func @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>)
-func @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>) -> ()
+// CHECK: func private @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>)
+func private @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>) -> ()
-// CHECK: func @vector_runtime_array_type(!spv.rtarray<vector<4xf32>>)
-func @vector_runtime_array_type(!spv.rtarray< vector<4xf32> >) -> ()
+// CHECK: func private @vector_runtime_array_type(!spv.rtarray<vector<4xf32>>)
+func private @vector_runtime_array_type(!spv.rtarray< vector<4xf32> >) -> ()
-// CHECK: func @runtime_array_type_stride(!spv.rtarray<f32, stride=4>)
-func @runtime_array_type_stride(!spv.rtarray<f32, stride=4>) -> ()
+// CHECK: func private @runtime_array_type_stride(!spv.rtarray<f32, stride=4>)
+func private @runtime_array_type_stride(!spv.rtarray<f32, stride=4>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
-func @missing_left_angle_bracket(!spv.rtarray f32>) -> ()
+func private @missing_left_angle_bracket(!spv.rtarray f32>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
-func @missing_element_type(!spv.rtarray<>) -> ()
+func private @missing_element_type(!spv.rtarray<>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
-func @redundant_count(!spv.rtarray<4xf32>) -> ()
+func private @redundant_count(!spv.rtarray<4xf32>) -> ()
// -----
// expected-error @+1 {{ArrayStride must be greater than zero}}
-func @runtime_array_type_zero_stride(!spv.rtarray<i32, stride=0>) -> ()
+func private @runtime_array_type_zero_stride(!spv.rtarray<i32, stride=0>) -> ()
// -----
@@ -161,68 +161,68 @@ func @runtime_array_type_zero_stride(!spv.rtarray<i32, stride=0>) -> ()
// ImageType
//===----------------------------------------------------------------------===//
-// CHECK: func @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)
-func @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
+// CHECK: func private @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)
+func private @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_one_element(!spv.image<f32>) -> ()
+func private @image_parameters_one_element(!spv.image<f32>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_two_elements(!spv.image<f32, Dim1D>) -> ()
+func private @image_parameters_two_elements(!spv.image<f32, Dim1D>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_three_elements(!spv.image<f32, Dim1D, NoDepth>) -> ()
+func private @image_parameters_three_elements(!spv.image<f32, Dim1D, NoDepth>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_four_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed>) -> ()
+func private @image_parameters_four_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_five_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled>) -> ()
+func private @image_parameters_five_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_six_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown>) -> ()
+func private @image_parameters_six_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
-func @image_parameters_delimiter(!spv.image f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
+func private @image_parameters_delimiter(!spv.image f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_nocomma_1(!spv.image<f32, Dim1D NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
+func private @image_parameters_nocomma_1(!spv.image<f32, Dim1D NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_nocomma_2(!spv.image<f32, Dim1D, NoDepth NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
+func private @image_parameters_nocomma_2(!spv.image<f32, Dim1D, NoDepth NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_nocomma_3(!spv.image<f32, Dim1D, NoDepth, NonArrayed SingleSampled, SamplerUnknown, Unknown>) -> ()
+func private @image_parameters_nocomma_3(!spv.image<f32, Dim1D, NoDepth, NonArrayed SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_nocomma_4(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled SamplerUnknown, Unknown>) -> ()
+func private @image_parameters_nocomma_4(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @image_parameters_nocomma_5(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown Unknown>) -> ()
+func private @image_parameters_nocomma_5(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown Unknown>) -> ()
// -----
@@ -230,119 +230,119 @@ func @image_parameters_nocomma_5(!spv.image<f32, Dim1D, NoDepth, NonArrayed, Sin
// StructType
//===----------------------------------------------------------------------===//
-// CHECK: func @struct_type(!spv.struct<(f32)>)
-func @struct_type(!spv.struct<(f32)>) -> ()
+// CHECK: func private @struct_type(!spv.struct<(f32)>)
+func private @struct_type(!spv.struct<(f32)>) -> ()
-// CHECK: func @struct_type2(!spv.struct<(f32 [0])>)
-func @struct_type2(!spv.struct<(f32 [0])>) -> ()
+// CHECK: func private @struct_type2(!spv.struct<(f32 [0])>)
+func private @struct_type2(!spv.struct<(f32 [0])>) -> ()
-// CHECK: func @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>)
-func @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>) -> ()
+// CHECK: func private @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>)
+func private @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>) -> ()
-// CHECK: func @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>)
-func @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>) -> ()
+// CHECK: func private @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>)
+func private @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>) -> ()
-// CHECK: func @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
-func @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
+// CHECK: func private @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
+func private @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
-// CHECK: func @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
-func @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
+// CHECK: func private @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
+func private @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
-// CHECK: func @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
-func @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
+// CHECK: func private @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
+func private @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
-// CHECK: func @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
-func @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
+// CHECK: func private @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
+func private @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
-// CHECK: func @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
-func @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
+// CHECK: func private @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
+func private @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
-// CHECK: func @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
-func @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
+// CHECK: func private @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
+func private @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
-// CHECK: func @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
-func @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
+// CHECK: func private @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
+func private @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
-// CHECK: func @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
-func @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
+// CHECK: func private @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
+func private @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
-// CHECK: func @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
-func @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
+// CHECK: func private @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
+func private @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
-// CHECK: func @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
-func @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
+// CHECK: func private @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
+func private @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
-// CHECK: func @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
-func @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
+// CHECK: func private @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
+func private @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
-// CHECK: func @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
-func @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
+// CHECK: func private @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
+func private @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
-// CHECK: func @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
-func @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
+// CHECK: func private @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
+func private @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
-// CHECK: func @struct_empty(!spv.struct<()>)
-func @struct_empty(!spv.struct<()>)
+// CHECK: func private @struct_empty(!spv.struct<()>)
+func private @struct_empty(!spv.struct<()>)
// -----
// expected-error @+1 {{offset specification must be given for all members}}
-func @struct_type_missing_offset1((!spv.struct<(f32, i32 [4])>) -> ()
+func private @struct_type_missing_offset1((!spv.struct<(f32, i32 [4])>) -> ()
// -----
// expected-error @+1 {{offset specification must be given for all members}}
-func @struct_type_missing_offset2(!spv.struct<(f32 [3], i32)>) -> ()
+func private @struct_type_missing_offset2(!spv.struct<(f32 [3], i32)>) -> ()
// -----
// expected-error @+1 {{expected ')'}}
-func @struct_type_missing_comma1(!spv.struct<(f32 i32)>) -> ()
+func private @struct_type_missing_comma1(!spv.struct<(f32 i32)>) -> ()
// -----
// expected-error @+1 {{expected ')'}}
-func @struct_type_missing_comma2(!spv.struct<(f32 [0] i32)>) -> ()
+func private @struct_type_missing_comma2(!spv.struct<(f32 [0] i32)>) -> ()
// -----
// expected-error @+1 {{unbalanced ')' character in pretty dialect name}}
-func @struct_type_neg_offset(!spv.struct<(f32 [0)>) -> ()
+func private @struct_type_neg_offset(!spv.struct<(f32 [0)>) -> ()
// -----
// expected-error @+1 {{unbalanced ']' character in pretty dialect name}}
-func @struct_type_neg_offset(!spv.struct<(f32 0])>) -> ()
+func private @struct_type_neg_offset(!spv.struct<(f32 0])>) -> ()
// -----
// expected-error @+1 {{expected ']'}}
-func @struct_type_neg_offset(!spv.struct<(f32 [NonWritable 0])>) -> ()
+func private @struct_type_neg_offset(!spv.struct<(f32 [NonWritable 0])>) -> ()
// -----
// expected-error @+1 {{expected valid keyword}}
-func @struct_type_neg_offset(!spv.struct<(f32 [NonWritable, 0])>) -> ()
+func private @struct_type_neg_offset(!spv.struct<(f32 [NonWritable, 0])>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @struct_type_missing_comma(!spv.struct<(f32 [0 NonWritable], i32 [4])>)
+func private @struct_type_missing_comma(!spv.struct<(f32 [0 NonWritable], i32 [4])>)
// -----
// expected-error @+1 {{expected ']'}}
-func @struct_type_missing_comma(!spv.struct<(f32 [0, NonWritable NonReadable], i32 [4])>)
+func private @struct_type_missing_comma(!spv.struct<(f32 [0, NonWritable NonReadable], i32 [4])>)
// -----
// expected-error @+1 {{expected ']'}}
-func @struct_type_missing_comma(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor MatrixStride=16])>)
+func private @struct_type_missing_comma(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor MatrixStride=16])>)
// -----
// expected-error @+1 {{expected integer value}}
-func @struct_missing_member_decorator_value(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=])>)
+func private @struct_missing_member_decorator_value(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=])>)
// -----
@@ -350,74 +350,74 @@ func @struct_missing_member_decorator_value(!spv.struct<(!spv.matrix<3 x vector<
// StructType (identified)
//===----------------------------------------------------------------------===//
-// CHECK: func @id_struct_empty(!spv.struct<empty, ()>)
-func @id_struct_empty(!spv.struct<empty, ()>) -> ()
+// CHECK: func private @id_struct_empty(!spv.struct<empty, ()>)
+func private @id_struct_empty(!spv.struct<empty, ()>) -> ()
// -----
-// CHECK: func @id_struct_simple(!spv.struct<simple, (f32)>)
-func @id_struct_simple(!spv.struct<simple, (f32)>) -> ()
+// CHECK: func private @id_struct_simple(!spv.struct<simple, (f32)>)
+func private @id_struct_simple(!spv.struct<simple, (f32)>) -> ()
// -----
-// CHECK: func @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>)
-func @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>) -> ()
+// CHECK: func private @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>)
+func private @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>) -> ()
// -----
-// CHECK: func @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>)
-func @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>) -> ()
+// CHECK: func private @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>)
+func private @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>) -> ()
// -----
-// CHECK: func @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>)
-func @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>) -> ()
+// CHECK: func private @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>)
+func private @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>) -> ()
// -----
-// CHECK: func @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>)
-func @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>) -> ()
+// CHECK: func private @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>)
+func private @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>) -> ()
// -----
-// CHECK: func @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>)
-func @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>) -> ()
+// CHECK: func private @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>)
+func private @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>) -> ()
// -----
-// CHECK: func @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>)
-func @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>) -> ()
+// CHECK: func private @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>)
+func private @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>) -> ()
// -----
// expected-error @+1 {{recursive struct reference not nested in struct definition}}
-func @id_wrong_recursive_reference(!spv.struct<a6>) -> ()
+func private @id_wrong_recursive_reference(!spv.struct<a6>) -> ()
// -----
// expected-error @+1 {{recursive struct reference not nested in struct definition}}
-func @id_struct_recursive_invalid(!spv.struct<a7, (!spv.ptr<!spv.struct<b7>, Uniform>)>) -> ()
+func private @id_struct_recursive_invalid(!spv.struct<a7, (!spv.ptr<!spv.struct<b7>, Uniform>)>) -> ()
// -----
// expected-error @+1 {{identifier already used for an enclosing struct}}
-func @id_struct_redefinition(!spv.struct<a8, (!spv.ptr<!spv.struct<a8, (!spv.ptr<!spv.struct<a8>, Uniform>)>, Uniform>)>) -> ()
+func private @id_struct_redefinition(!spv.struct<a8, (!spv.ptr<!spv.struct<a8, (!spv.ptr<!spv.struct<a8>, Uniform>)>, Uniform>)>) -> ()
// -----
// Equivalent to:
// struct a { struct b *bPtr; };
// struct b { struct a *aPtr; };
-// CHECK: func @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>)
-func @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>) -> ()
+// CHECK: func private @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>)
+func private @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>) -> ()
// -----
// Equivalent to:
// struct a { struct b *bPtr; };
// struct b { struct a *aPtr, struct b *bPtr; };
-// CHECK: func @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>)
-func @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>) -> ()
+// CHECK: func private @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>)
+func private @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>) -> ()
// -----
@@ -425,100 +425,100 @@ func @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<
// CooperativeMatrix
//===----------------------------------------------------------------------===//
-// CHECK: func @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>)
-func @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>) -> ()
+// CHECK: func private @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>)
+func private @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>) -> ()
// -----
// expected-error @+1 {{expected ','}}
-func @missing_scope(!spv.coopmatrix<8x16xi32>) -> ()
+func private @missing_scope(!spv.coopmatrix<8x16xi32>) -> ()
// -----
// expected-error @+1 {{expected rows and columns size}}
-func @missing_count(!spv.coopmatrix<8xi32, Subgroup>) -> ()
+func private @missing_count(!spv.coopmatrix<8xi32, Subgroup>) -> ()
// -----
//===----------------------------------------------------------------------===//
// Matrix
//===----------------------------------------------------------------------===//
-// CHECK: func @matrix_type(!spv.matrix<2 x vector<2xf16>>)
-func @matrix_type(!spv.matrix<2 x vector<2xf16>>) -> ()
+// CHECK: func private @matrix_type(!spv.matrix<2 x vector<2xf16>>)
+func private @matrix_type(!spv.matrix<2 x vector<2xf16>>) -> ()
// -----
-// CHECK: func @matrix_type(!spv.matrix<3 x vector<3xf32>>)
-func @matrix_type(!spv.matrix<3 x vector<3xf32>>) -> ()
+// CHECK: func private @matrix_type(!spv.matrix<3 x vector<3xf32>>)
+func private @matrix_type(!spv.matrix<3 x vector<3xf32>>) -> ()
// -----
-// CHECK: func @matrix_type(!spv.matrix<4 x vector<4xf16>>)
-func @matrix_type(!spv.matrix<4 x vector<4xf16>>) -> ()
+// CHECK: func private @matrix_type(!spv.matrix<4 x vector<4xf16>>)
+func private @matrix_type(!spv.matrix<4 x vector<4xf16>>) -> ()
// -----
// expected-error @+1 {{matrix is expected to have 2, 3, or 4 columns}}
-func @matrix_invalid_size(!spv.matrix<5 x vector<3xf32>>) -> ()
+func private @matrix_invalid_size(!spv.matrix<5 x vector<3xf32>>) -> ()
// -----
// expected-error @+1 {{matrix is expected to have 2, 3, or 4 columns}}
-func @matrix_invalid_size(!spv.matrix<1 x vector<3xf32>>) -> ()
+func private @matrix_invalid_size(!spv.matrix<1 x vector<3xf32>>) -> ()
// -----
// expected-error @+1 {{matrix columns size has to be less than or equal to 4 and greater than or equal 2, but found 5}}
-func @matrix_invalid_columns_size(!spv.matrix<3 x vector<5xf32>>) -> ()
+func private @matrix_invalid_columns_size(!spv.matrix<3 x vector<5xf32>>) -> ()
// -----
// expected-error @+1 {{matrix columns size has to be less than or equal to 4 and greater than or equal 2, but found 1}}
-func @matrix_invalid_columns_size(!spv.matrix<3 x vector<1xf32>>) -> ()
+func private @matrix_invalid_columns_size(!spv.matrix<3 x vector<1xf32>>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
-func @matrix_invalid_format(!spv.matrix 3 x vector<3xf32>>) -> ()
+func private @matrix_invalid_format(!spv.matrix 3 x vector<3xf32>>) -> ()
// -----
// expected-error @+1 {{unbalanced ')' character in pretty dialect name}}
-func @matrix_invalid_format(!spv.matrix< 3 x vector<3xf32>) -> ()
+func private @matrix_invalid_format(!spv.matrix< 3 x vector<3xf32>) -> ()
// -----
// expected-error @+1 {{expected 'x' in dimension list}}
-func @matrix_invalid_format(!spv.matrix<2 vector<3xi32>>) -> ()
+func private @matrix_invalid_format(!spv.matrix<2 vector<3xi32>>) -> ()
// -----
// expected-error @+1 {{matrix must be composed using vector type, got 'i32'}}
-func @matrix_invalid_type(!spv.matrix< 3 x i32>) -> ()
+func private @matrix_invalid_type(!spv.matrix< 3 x i32>) -> ()
// -----
// expected-error @+1 {{matrix must be composed using vector type, got '!spv.array<16 x f32>'}}
-func @matrix_invalid_type(!spv.matrix< 3 x !spv.array<16 x f32>>) -> ()
+func private @matrix_invalid_type(!spv.matrix< 3 x !spv.array<16 x f32>>) -> ()
// -----
// expected-error @+1 {{matrix must be composed using vector type, got '!spv.rtarray<i32>'}}
-func @matrix_invalid_type(!spv.matrix< 3 x !spv.rtarray<i32>>) -> ()
+func private @matrix_invalid_type(!spv.matrix< 3 x !spv.rtarray<i32>>) -> ()
// -----
// expected-error @+1 {{matrix columns' elements must be of Float type, got 'i32'}}
-func @matrix_invalid_type(!spv.matrix<2 x vector<3xi32>>) -> ()
+func private @matrix_invalid_type(!spv.matrix<2 x vector<3xi32>>) -> ()
// -----
// expected-error @+1 {{expected single unsigned integer for number of columns}}
-func @matrix_size_type(!spv.matrix< x vector<3xi32>>) -> ()
+func private @matrix_size_type(!spv.matrix< x vector<3xi32>>) -> ()
// -----
// expected-error @+1 {{expected single unsigned integer for number of columns}}
-func @matrix_size_type(!spv.matrix<2.0 x vector<3xi32>>) -> ()
+func private @matrix_size_type(!spv.matrix<2.0 x vector<3xi32>>) -> ()
// -----
diff --git a/mlir/test/Dialect/Standard/func-bufferize.mlir b/mlir/test/Dialect/Standard/func-bufferize.mlir
index 20af66cdb880..61c5e184cd17 100644
--- a/mlir/test/Dialect/Standard/func-bufferize.mlir
+++ b/mlir/test/Dialect/Standard/func-bufferize.mlir
@@ -34,22 +34,22 @@ func @eliminate_source_materialization(%arg0: memref<f32>) -> tensor<f32> {
return %0 : tensor<f32>
}
-// CHECK-LABEL: func @source() -> memref<f32>
+// CHECK-LABEL: func private @source() -> memref<f32>
// CHECK-LABEL: func @call_source() -> memref<f32> {
// CHECK: %[[RET:.*]] = call @source() : () -> memref<f32>
// CHECK: return %[[RET]] : memref<f32>
-func @source() -> tensor<f32>
+func private @source() -> tensor<f32>
func @call_source() -> tensor<f32> {
%0 = call @source() : () -> tensor<f32>
return %0 : tensor<f32>
}
-// CHECK-LABEL: func @sink(memref<f32>)
+// CHECK-LABEL: func private @sink(memref<f32>)
// CHECK-LABEL: func @call_sink(
// CHECK-SAME: %[[ARG:.*]]: memref<f32>) {
// CHECK: call @sink(%[[ARG]]) : (memref<f32>) -> ()
// CHECK: return
-func @sink(tensor<f32>)
+func private @sink(tensor<f32>)
func @call_sink(%arg0: tensor<f32>) {
call @sink(%arg0) : (tensor<f32>) -> ()
return
diff --git a/mlir/test/IR/affine-map.mlir b/mlir/test/IR/affine-map.mlir
index f953c00e2043..3e3e2c3fe6f6 100644
--- a/mlir/test/IR/affine-map.mlir
+++ b/mlir/test/IR/affine-map.mlir
@@ -190,183 +190,183 @@
#map58 = affine_map<(d0, d1) -> (4*d0 - 2*d0 + d0, (d0 + d1) + (d0 + d1), 2 * (d0 mod 2) - d0 mod 2)>
// Single identity maps are removed.
-// CHECK: func @f0(memref<2x4xi8, 1>)
-func @f0(memref<2x4xi8, #map0, 1>)
+// CHECK: @f0(memref<2x4xi8, 1>)
+func private @f0(memref<2x4xi8, #map0, 1>)
// Single identity maps are removed.
-// CHECK: func @f1(memref<2x4xi8, 1>)
-func @f1(memref<2x4xi8, #map1, 1>)
+// CHECK: @f1(memref<2x4xi8, 1>)
+func private @f1(memref<2x4xi8, #map1, 1>)
-// CHECK: func @f2(memref<i8, #map{{[0-9]+}}, 1>)
-func @f2(memref<i8, #map2, 1>)
+// CHECK: @f2(memref<i8, #map{{[0-9]+}}, 1>)
+func private @f2(memref<i8, #map2, 1>)
-// CHECK: func @f3(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3(memref<2x4xi8, #map3, 1>)
-// CHECK: func @f3a(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3a(memref<2x4xi8, #map3a, 1>)
-// CHECK: func @f3b(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3b(memref<2x4xi8, #map3b, 1>)
-// CHECK: func @f3c(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3c(memref<2x4xi8, #map3c, 1>)
-// CHECK: func @f3d(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3d(memref<2x4xi8, #map3d, 1>)
-// CHECK: func @f3e(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3e(memref<2x4xi8, #map3e, 1>)
-// CHECK: func @f3f(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3f(memref<2x4xi8, #map3f, 1>)
-// CHECK: func @f3g(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3g(memref<2x4xi8, #map3g, 1>)
-// CHECK: func @f3h(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3h(memref<2x4xi8, #map3h, 1>)
-// CHECK: func @f3i(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3i(memref<2x4xi8, #map3i, 1>)
-// CHECK: func @f3j(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3j(memref<2x4xi8, #map3j, 1>)
-// CHECK: func @f3k(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3k(memref<2x4xi8, #map3k, 1>)
-// CHECK: func @f3l(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f3l(memref<2x4xi8, #map3l, 1>)
+// CHECK: @f3(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3(memref<2x4xi8, #map3, 1>)
+// CHECK: @f3a(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3a(memref<2x4xi8, #map3a, 1>)
+// CHECK: @f3b(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3b(memref<2x4xi8, #map3b, 1>)
+// CHECK: @f3c(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3c(memref<2x4xi8, #map3c, 1>)
+// CHECK: @f3d(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3d(memref<2x4xi8, #map3d, 1>)
+// CHECK: @f3e(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3e(memref<2x4xi8, #map3e, 1>)
+// CHECK: @f3f(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3f(memref<2x4xi8, #map3f, 1>)
+// CHECK: @f3g(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3g(memref<2x4xi8, #map3g, 1>)
+// CHECK: @f3h(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3h(memref<2x4xi8, #map3h, 1>)
+// CHECK: @f3i(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3i(memref<2x4xi8, #map3i, 1>)
+// CHECK: @f3j(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3j(memref<2x4xi8, #map3j, 1>)
+// CHECK: @f3k(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3k(memref<2x4xi8, #map3k, 1>)
+// CHECK: @f3l(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f3l(memref<2x4xi8, #map3l, 1>)
-// CHECK: func @f4(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f4(memref<2x4xi8, #map4, 1>)
+// CHECK: @f4(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f4(memref<2x4xi8, #map4, 1>)
-// CHECK: func @f5(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f5(memref<2x4xi8, #map5, 1>)
+// CHECK: @f5(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f5(memref<2x4xi8, #map5, 1>)
-// CHECK: func @f6(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f6(memref<2x4xi8, #map6, 1>)
+// CHECK: @f6(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f6(memref<2x4xi8, #map6, 1>)
-// CHECK: func @f7(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f7(memref<2x4xi8, #map7, 1>)
+// CHECK: @f7(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f7(memref<2x4xi8, #map7, 1>)
-// CHECK: func @f8(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f8(memref<2x4xi8, #map8, 1>)
+// CHECK: @f8(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f8(memref<2x4xi8, #map8, 1>)
-// CHECK: func @f9(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f9(memref<2x4xi8, #map9, 1>)
+// CHECK: @f9(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f9(memref<2x4xi8, #map9, 1>)
-// CHECK: func @f10(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f10(memref<2x4xi8, #map10, 1>)
+// CHECK: @f10(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f10(memref<2x4xi8, #map10, 1>)
-// CHECK: func @f11(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f11(memref<2x4xi8, #map11, 1>)
+// CHECK: @f11(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f11(memref<2x4xi8, #map11, 1>)
-// CHECK: func @f12(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f12(memref<2x4xi8, #map12, 1>)
+// CHECK: @f12(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f12(memref<2x4xi8, #map12, 1>)
-// CHECK: func @f13(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f13(memref<2x4xi8, #map13, 1>)
+// CHECK: @f13(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f13(memref<2x4xi8, #map13, 1>)
-// CHECK: func @f14(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f14(memref<2x4xi8, #map14, 1>)
+// CHECK: @f14(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f14(memref<2x4xi8, #map14, 1>)
-// CHECK: func @f15(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f15(memref<2x4xi8, #map15, 1>)
+// CHECK: @f15(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f15(memref<2x4xi8, #map15, 1>)
-// CHECK: func @f16(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f16(memref<2x4xi8, #map16, 1>)
+// CHECK: @f16(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f16(memref<2x4xi8, #map16, 1>)
-// CHECK: func @f17(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f17(memref<2x4xi8, #map17, 1>)
+// CHECK: @f17(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f17(memref<2x4xi8, #map17, 1>)
-// CHECK: func @f19(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f19(memref<2x4xi8, #map19, 1>)
+// CHECK: @f19(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f19(memref<2x4xi8, #map19, 1>)
-// CHECK: func @f20(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f20(memref<2x4xi8, #map20, 1>)
+// CHECK: @f20(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f20(memref<2x4xi8, #map20, 1>)
-// CHECK: func @f18(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f18(memref<2x4xi8, #map18, 1>)
+// CHECK: @f18(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f18(memref<2x4xi8, #map18, 1>)
-// CHECK: func @f21(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f21(memref<2x4xi8, #map21, 1>)
+// CHECK: @f21(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f21(memref<2x4xi8, #map21, 1>)
-// CHECK: func @f22(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f22(memref<2x4xi8, #map22, 1>)
+// CHECK: @f22(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f22(memref<2x4xi8, #map22, 1>)
-// CHECK: func @f23(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f23(memref<2x4xi8, #map23, 1>)
+// CHECK: @f23(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f23(memref<2x4xi8, #map23, 1>)
-// CHECK: func @f24(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f24(memref<2x4xi8, #map24, 1>)
+// CHECK: @f24(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f24(memref<2x4xi8, #map24, 1>)
-// CHECK: func @f25(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f25(memref<2x4xi8, #map25, 1>)
+// CHECK: @f25(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f25(memref<2x4xi8, #map25, 1>)
-// CHECK: func @f26(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f26(memref<2x4xi8, #map26, 1>)
+// CHECK: @f26(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f26(memref<2x4xi8, #map26, 1>)
-// CHECK: func @f29(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f29(memref<2x4xi8, #map29, 1>)
+// CHECK: @f29(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f29(memref<2x4xi8, #map29, 1>)
-// CHECK: func @f30(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f30(memref<2x4xi8, #map30, 1>)
+// CHECK: @f30(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f30(memref<2x4xi8, #map30, 1>)
-// CHECK: func @f32(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f32(memref<2x4xi8, #map32, 1>)
+// CHECK: @f32(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f32(memref<2x4xi8, #map32, 1>)
-// CHECK: func @f33(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f33(memref<2x4xi8, #map33, 1>)
+// CHECK: @f33(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f33(memref<2x4xi8, #map33, 1>)
-// CHECK: func @f34(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f34(memref<2x4xi8, #map34, 1>)
+// CHECK: @f34(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f34(memref<2x4xi8, #map34, 1>)
-// CHECK: func @f35(memref<2x4x4xi8, #map{{[0-9]+}}, 1>)
-func @f35(memref<2x4x4xi8, #map35, 1>)
+// CHECK: @f35(memref<2x4x4xi8, #map{{[0-9]+}}, 1>)
+func private @f35(memref<2x4x4xi8, #map35, 1>)
-// CHECK: func @f36(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f36(memref<2x4xi8, #map36, 1>)
+// CHECK: @f36(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f36(memref<2x4xi8, #map36, 1>)
-// CHECK: func @f37(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f37(memref<2x4xi8, #map37, 1>)
+// CHECK: @f37(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f37(memref<2x4xi8, #map37, 1>)
-// CHECK: func @f38(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f38(memref<2x4xi8, #map38, 1>)
+// CHECK: @f38(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f38(memref<2x4xi8, #map38, 1>)
-// CHECK: func @f39(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-func @f39(memref<2x4xi8, #map39, 1>)
+// CHECK: @f39(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func private @f39(memref<2x4xi8, #map39, 1>)
-// CHECK: func @f43(memref<2x4xi8, #map{{[0-9]+}}>)
-func @f43(memref<2x4xi8, #map43>)
+// CHECK: @f43(memref<2x4xi8, #map{{[0-9]+}}>)
+func private @f43(memref<2x4xi8, #map43>)
-// CHECK: func @f44(memref<2x4xi8, #map{{[0-9]+}}>)
-func @f44(memref<2x4xi8, #map44>)
+// CHECK: @f44(memref<2x4xi8, #map{{[0-9]+}}>)
+func private @f44(memref<2x4xi8, #map44>)
-// CHECK: func @f45(memref<100x100x100xi8, #map{{[0-9]+}}>)
-func @f45(memref<100x100x100xi8, #map45>)
+// CHECK: @f45(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func private @f45(memref<100x100x100xi8, #map45>)
-// CHECK: func @f46(memref<100x100x100xi8, #map{{[0-9]+}}>)
-func @f46(memref<100x100x100xi8, #map46>)
+// CHECK: @f46(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func private @f46(memref<100x100x100xi8, #map46>)
-// CHECK: func @f47(memref<100x100x100xi8, #map{{[0-9]+}}>)
-func @f47(memref<100x100x100xi8, #map47>)
+// CHECK: @f47(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func private @f47(memref<100x100x100xi8, #map47>)
-// CHECK: func @f48(memref<100x100x100xi8, #map{{[0-9]+}}>)
-func @f48(memref<100x100x100xi8, #map48>)
+// CHECK: @f48(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func private @f48(memref<100x100x100xi8, #map48>)
-// CHECK: func @f49(memref<100x100xi8, #map{{[0-9]+}}>)
-func @f49(memref<100x100xi8, #map49>)
+// CHECK: @f49(memref<100x100xi8, #map{{[0-9]+}}>)
+func private @f49(memref<100x100xi8, #map49>)
-// CHECK: func @f50(memref<100x100xi8, #map{{[0-9]+}}>)
-func @f50(memref<100x100xi8, #map50>)
+// CHECK: @f50(memref<100x100xi8, #map{{[0-9]+}}>)
+func private @f50(memref<100x100xi8, #map50>)
-// CHECK: func @f51(memref<1xi8, #map{{[0-9]+}}>)
-func @f51(memref<1xi8, #map51>)
+// CHECK: @f51(memref<1xi8, #map{{[0-9]+}}>)
+func private @f51(memref<1xi8, #map51>)
-// CHECK: func @f52(memref<1xi8, #map{{[0-9]+}}>)
-func @f52(memref<1xi8, #map52>)
+// CHECK: @f52(memref<1xi8, #map{{[0-9]+}}>)
+func private @f52(memref<1xi8, #map52>)
-// CHECK: func @f53(memref<1xi8, #map{{[0-9]+}}>)
-func @f53(memref<1xi8, #map53>)
+// CHECK: @f53(memref<1xi8, #map{{[0-9]+}}>)
+func private @f53(memref<1xi8, #map53>)
-// CHECK: func @f54(memref<10xi32, #map{{[0-9]+}}>)
-func @f54(memref<10xi32, #map54>)
+// CHECK: @f54(memref<10xi32, #map{{[0-9]+}}>)
+func private @f54(memref<10xi32, #map54>)
// CHECK: "foo.op"() {map = #map{{[0-9]+}}} : () -> ()
"foo.op"() {map = #map55} : () -> ()
-// CHECK: func @f56(memref<1x1xi8, #map{{[0-9]+}}>)
-func @f56(memref<1x1xi8, #map56>)
+// CHECK: @f56(memref<1x1xi8, #map{{[0-9]+}}>)
+func private @f56(memref<1x1xi8, #map56>)
// CHECK: "f57"() {map = #map{{[0-9]+}}} : () -> ()
"f57"() {map = #map57} : () -> ()
diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir
index 838452619990..c894bf47c2a6 100644
--- a/mlir/test/IR/core-ops.mlir
+++ b/mlir/test/IR/core-ops.mlir
@@ -748,7 +748,7 @@ func @memref_cast(%arg0: memref<4xf32>, %arg1 : memref<?xf32>, %arg2 : memref<64
// Check that unranked memrefs with non-default memory space roundtrip
// properly.
// CHECK-LABEL: @unranked_memref_roundtrip(memref<*xf32, 4>)
-func @unranked_memref_roundtrip(memref<*xf32, 4>)
+func private @unranked_memref_roundtrip(memref<*xf32, 4>)
// CHECK-LABEL: func @memref_view(%arg0
func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) {
diff --git a/mlir/test/IR/invalid-func-op.mlir b/mlir/test/IR/invalid-func-op.mlir
index 20af5ece6b11..afa736998076 100644
--- a/mlir/test/IR/invalid-func-op.mlir
+++ b/mlir/test/IR/invalid-func-op.mlir
@@ -73,3 +73,8 @@ func @f(%arg0: i64 {test.invalid_attr}) {
func @f(%arg0: i64) -> (i64 {test.invalid_attr}) {
return %arg0 : i64
}
+
+// -----
+
+// expected-error at +1 {{symbol declaration cannot have public visibility}}
+func @invalid_public_declaration()
diff --git a/mlir/test/IR/locations.mlir b/mlir/test/IR/locations.mlir
index f7c9636d2ba4..950b67827a0f 100644
--- a/mlir/test/IR/locations.mlir
+++ b/mlir/test/IR/locations.mlir
@@ -24,8 +24,8 @@ func @inline_notation() -> i32 {
return %1 : i32 loc(unknown)
}
-// CHECK-LABEL: func @loc_attr(i1 {foo.loc_attr = loc(callsite("foo" at "mysource.cc":10:8))})
-func @loc_attr(i1 {foo.loc_attr = loc(callsite("foo" at "mysource.cc":10:8))})
+// CHECK-LABEL: func private @loc_attr(i1 {foo.loc_attr = loc(callsite("foo" at "mysource.cc":10:8))})
+func private @loc_attr(i1 {foo.loc_attr = loc(callsite("foo" at "mysource.cc":10:8))})
// CHECK-ALIAS: "foo.op"() : () -> () loc(#[[LOC:.*]])
"foo.op"() : () -> () loc(#loc)
diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir
index ecb9ccc296ba..9098e9ace5fa 100644
--- a/mlir/test/IR/parser.mlir
+++ b/mlir/test/IR/parser.mlir
@@ -46,120 +46,120 @@
// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0] : (d0 - 2 >= 0, -d0 + 4 >= 0)>
-// CHECK: func @foo(i32, i64) -> f32
-func @foo(i32, i64) -> f32
+// CHECK: func private @foo(i32, i64) -> f32
+func private @foo(i32, i64) -> f32
-// CHECK: func @bar()
-func @bar() -> ()
+// CHECK: func private @bar()
+func private @bar() -> ()
-// CHECK: func @baz() -> (i1, index, f32)
-func @baz() -> (i1, index, f32)
+// CHECK: func private @baz() -> (i1, index, f32)
+func private @baz() -> (i1, index, f32)
-// CHECK: func @missingReturn()
-func @missingReturn()
+// CHECK: func private @missingReturn()
+func private @missingReturn()
-// CHECK: func @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
-func @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
+// CHECK: func private @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
+func private @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
-// CHECK: func @sint_types(si2, si4) -> (si7, si1023)
-func @sint_types(si2, si4) -> (si7, si1023)
+// CHECK: func private @sint_types(si2, si4) -> (si7, si1023)
+func private @sint_types(si2, si4) -> (si7, si1023)
-// CHECK: func @uint_types(ui2, ui4) -> (ui7, ui1023)
-func @uint_types(ui2, ui4) -> (ui7, ui1023)
+// CHECK: func private @uint_types(ui2, ui4) -> (ui7, ui1023)
+func private @uint_types(ui2, ui4) -> (ui7, ui1023)
-// CHECK: func @vectors(vector<1xf32>, vector<2x4xf32>)
-func @vectors(vector<1 x f32>, vector<2x4xf32>)
+// CHECK: func private @vectors(vector<1xf32>, vector<2x4xf32>)
+func private @vectors(vector<1 x f32>, vector<2x4xf32>)
-// CHECK: func @tensors(tensor<*xf32>, tensor<*xvector<2x4xf32>>, tensor<1x?x4x?x?xi32>, tensor<i8>)
-func @tensors(tensor<* x f32>, tensor<* x vector<2x4xf32>>,
+// CHECK: func private @tensors(tensor<*xf32>, tensor<*xvector<2x4xf32>>, tensor<1x?x4x?x?xi32>, tensor<i8>)
+func private @tensors(tensor<* x f32>, tensor<* x vector<2x4xf32>>,
tensor<1x?x4x?x?xi32>, tensor<i8>)
-// CHECK: func @memrefs(memref<1x?x4x?x?xi32, #map{{[0-9]+}}>, memref<8xi8>)
-func @memrefs(memref<1x?x4x?x?xi32, #map0>, memref<8xi8, #map1, #map1>)
+// CHECK: func private @memrefs(memref<1x?x4x?x?xi32, #map{{[0-9]+}}>, memref<8xi8>)
+func private @memrefs(memref<1x?x4x?x?xi32, #map0>, memref<8xi8, #map1, #map1>)
// Test memref affine map compositions.
-// CHECK: func @memrefs2(memref<2x4x8xi8, 1>)
-func @memrefs2(memref<2x4x8xi8, #map2, 1>)
+// CHECK: func private @memrefs2(memref<2x4x8xi8, 1>)
+func private @memrefs2(memref<2x4x8xi8, #map2, 1>)
-// CHECK: func @memrefs23(memref<2x4x8xi8, #map{{[0-9]+}}>)
-func @memrefs23(memref<2x4x8xi8, #map2, #map3, 0>)
+// CHECK: func private @memrefs23(memref<2x4x8xi8, #map{{[0-9]+}}>)
+func private @memrefs23(memref<2x4x8xi8, #map2, #map3, 0>)
-// CHECK: func @memrefs234(memref<2x4x8xi8, #map{{[0-9]+}}, #map{{[0-9]+}}, 3>)
-func @memrefs234(memref<2x4x8xi8, #map2, #map3, #map4, 3>)
+// CHECK: func private @memrefs234(memref<2x4x8xi8, #map{{[0-9]+}}, #map{{[0-9]+}}, 3>)
+func private @memrefs234(memref<2x4x8xi8, #map2, #map3, #map4, 3>)
// Test memref inline affine map compositions, minding that identity maps are removed.
-// CHECK: func @memrefs3(memref<2x4x8xi8>)
-func @memrefs3(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>>)
+// CHECK: func private @memrefs3(memref<2x4x8xi8>)
+func private @memrefs3(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>>)
-// CHECK: func @memrefs33(memref<2x4x8xi8, #map{{[0-9]+}}, 1>)
-func @memrefs33(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d0, d2)>, 1>)
+// CHECK: func private @memrefs33(memref<2x4x8xi8, #map{{[0-9]+}}, 1>)
+func private @memrefs33(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d0, d2)>, 1>)
-// CHECK: func @memrefs_drop_triv_id_inline(memref<2xi8>)
-func @memrefs_drop_triv_id_inline(memref<2xi8, affine_map<(d0) -> (d0)>>)
+// CHECK: func private @memrefs_drop_triv_id_inline(memref<2xi8>)
+func private @memrefs_drop_triv_id_inline(memref<2xi8, affine_map<(d0) -> (d0)>>)
-// CHECK: func @memrefs_drop_triv_id_inline0(memref<2xi8>)
-func @memrefs_drop_triv_id_inline0(memref<2xi8, affine_map<(d0) -> (d0)>, 0>)
+// CHECK: func private @memrefs_drop_triv_id_inline0(memref<2xi8>)
+func private @memrefs_drop_triv_id_inline0(memref<2xi8, affine_map<(d0) -> (d0)>, 0>)
-// CHECK: func @memrefs_drop_triv_id_inline1(memref<2xi8, 1>)
-func @memrefs_drop_triv_id_inline1(memref<2xi8, affine_map<(d0) -> (d0)>, 1>)
+// CHECK: func private @memrefs_drop_triv_id_inline1(memref<2xi8, 1>)
+func private @memrefs_drop_triv_id_inline1(memref<2xi8, affine_map<(d0) -> (d0)>, 1>)
// Identity maps should be dropped from the composition, but not the pair of
// "interchange" maps that, if composed, would be also an identity.
-// CHECK: func @memrefs_drop_triv_id_composition(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
-func @memrefs_drop_triv_id_composition(memref<2x2xi8,
+// CHECK: func private @memrefs_drop_triv_id_composition(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
+func private @memrefs_drop_triv_id_composition(memref<2x2xi8,
affine_map<(d0, d1) -> (d1, d0)>,
affine_map<(d0, d1) -> (d0, d1)>,
affine_map<(d0, d1) -> (d1, d0)>,
affine_map<(d0, d1) -> (d0, d1)>,
affine_map<(d0, d1) -> (d0, d1)>>)
-// CHECK: func @memrefs_drop_triv_id_trailing(memref<2x2xi8, #map{{[0-9]+}}>)
-func @memrefs_drop_triv_id_trailing(memref<2x2xi8, affine_map<(d0, d1) -> (d1, d0)>,
+// CHECK: func private @memrefs_drop_triv_id_trailing(memref<2x2xi8, #map{{[0-9]+}}>)
+func private @memrefs_drop_triv_id_trailing(memref<2x2xi8, affine_map<(d0, d1) -> (d1, d0)>,
affine_map<(d0, d1) -> (d0, d1)>>)
-// CHECK: func @memrefs_drop_triv_id_middle(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
-func @memrefs_drop_triv_id_middle(memref<2x2xi8,
+// CHECK: func private @memrefs_drop_triv_id_middle(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
+func private @memrefs_drop_triv_id_middle(memref<2x2xi8,
affine_map<(d0, d1) -> (d0, d1 + 1)>,
affine_map<(d0, d1) -> (d0, d1)>,
affine_map<(d0, d1) -> (d0 + 1, d1)>>)
-// CHECK: func @memrefs_drop_triv_id_multiple(memref<2xi8>)
-func @memrefs_drop_triv_id_multiple(memref<2xi8, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>>)
+// CHECK: func private @memrefs_drop_triv_id_multiple(memref<2xi8>)
+func private @memrefs_drop_triv_id_multiple(memref<2xi8, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>>)
// These maps appeared before, so they must be uniqued and hoisted to the beginning.
// Identity map should be removed.
-// CHECK: func @memrefs_compose_with_id(memref<2x2xi8, #map{{[0-9]+}}>)
-func @memrefs_compose_with_id(memref<2x2xi8, affine_map<(d0, d1) -> (d0, d1)>,
+// CHECK: func private @memrefs_compose_with_id(memref<2x2xi8, #map{{[0-9]+}}>)
+func private @memrefs_compose_with_id(memref<2x2xi8, affine_map<(d0, d1) -> (d0, d1)>,
affine_map<(d0, d1) -> (d1, d0)>>)
-// CHECK: func @complex_types(complex<i1>) -> complex<f32>
-func @complex_types(complex<i1>) -> complex<f32>
+// CHECK: func private @complex_types(complex<i1>) -> complex<f32>
+func private @complex_types(complex<i1>) -> complex<f32>
-// CHECK: func @memref_with_index_elems(memref<1x?xindex>)
-func @memref_with_index_elems(memref<1x?xindex>)
+// CHECK: func private @memref_with_index_elems(memref<1x?xindex>)
+func private @memref_with_index_elems(memref<1x?xindex>)
-// CHECK: func @memref_with_complex_elems(memref<1x?xcomplex<f32>>)
-func @memref_with_complex_elems(memref<1x?xcomplex<f32>>)
+// CHECK: func private @memref_with_complex_elems(memref<1x?xcomplex<f32>>)
+func private @memref_with_complex_elems(memref<1x?xcomplex<f32>>)
-// CHECK: func @memref_with_vector_elems(memref<1x?xvector<10xf32>>)
-func @memref_with_vector_elems(memref<1x?xvector<10xf32>>)
+// CHECK: func private @memref_with_vector_elems(memref<1x?xvector<10xf32>>)
+func private @memref_with_vector_elems(memref<1x?xvector<10xf32>>)
-// CHECK: func @unranked_memref_with_complex_elems(memref<*xcomplex<f32>>)
-func @unranked_memref_with_complex_elems(memref<*xcomplex<f32>>)
+// CHECK: func private @unranked_memref_with_complex_elems(memref<*xcomplex<f32>>)
+func private @unranked_memref_with_complex_elems(memref<*xcomplex<f32>>)
-// CHECK: func @unranked_memref_with_index_elems(memref<*xindex>)
-func @unranked_memref_with_index_elems(memref<*xindex>)
+// CHECK: func private @unranked_memref_with_index_elems(memref<*xindex>)
+func private @unranked_memref_with_index_elems(memref<*xindex>)
-// CHECK: func @unranked_memref_with_vector_elems(memref<*xvector<10xf32>>)
-func @unranked_memref_with_vector_elems(memref<*xvector<10xf32>>)
+// CHECK: func private @unranked_memref_with_vector_elems(memref<*xvector<10xf32>>)
+func private @unranked_memref_with_vector_elems(memref<*xvector<10xf32>>)
-// CHECK: func @functions((memref<1x?x4x?x?xi32, #map0>, memref<8xi8>) -> (), () -> ())
-func @functions((memref<1x?x4x?x?xi32, #map0, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
+// CHECK: func private @functions((memref<1x?x4x?x?xi32, #map0>, memref<8xi8>) -> (), () -> ())
+func private @functions((memref<1x?x4x?x?xi32, #map0, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
// CHECK-LABEL: func @simpleCFG(%{{.*}}: i32, %{{.*}}: f32) -> i1 {
func @simpleCFG(%arg0: i32, %f: f32) -> i1 {
@@ -565,17 +565,17 @@ func @floatAttrs() -> () {
return
}
-// CHECK-LABEL: func @externalfuncattr
-func @externalfuncattr() -> ()
+// CHECK-LABEL: func private @externalfuncattr
+func private @externalfuncattr() -> ()
// CHECK: attributes {dialect.a = "a\22quoted\22string", dialect.b = 4.000000e+00 : f64, dialect.c = tensor<*xf32>}
attributes {dialect.a = "a\"quoted\"string", dialect.b = 4.0, dialect.c = tensor<*xf32>}
-// CHECK-LABEL: func @funcattrempty
-func @funcattrempty() -> ()
+// CHECK-LABEL: func private @funcattrempty
+func private @funcattrempty() -> ()
attributes {}
-// CHECK-LABEL: func @funcattr
-func @funcattr() -> ()
+// CHECK-LABEL: func private @funcattr
+func private @funcattr() -> ()
// CHECK: attributes {dialect.a = "a\22quoted\22string", dialect.b = 4.000000e+00 : f64, dialect.c = tensor<*xf32>}
attributes {dialect.a = "a\"quoted\"string", dialect.b = 4.0, dialect.c = tensor<*xf32>} {
^bb0:
@@ -888,11 +888,11 @@ func @dialect_attrs()
return
}
-// CHECK-LABEL: func @_valid.function$name
-func @_valid.function$name()
+// CHECK-LABEL: func private @_valid.function$name
+func private @_valid.function$name()
-// CHECK-LABEL: func @external_func_arg_attrs(i32, i1 {dialect.attr = 10 : i64}, i32)
-func @external_func_arg_attrs(i32, i1 {dialect.attr = 10 : i64}, i32)
+// CHECK-LABEL: func private @external_func_arg_attrs(i32, i1 {dialect.attr = 10 : i64}, i32)
+func private @external_func_arg_attrs(i32, i1 {dialect.attr = 10 : i64}, i32)
// CHECK-LABEL: func @func_arg_attrs(%{{.*}}: i1 {dialect.attr = 10 : i64})
func @func_arg_attrs(%arg0: i1 {dialect.attr = 10 : i64}) {
@@ -904,17 +904,17 @@ func @func_result_attrs(%arg0: f32) -> (f32 {dialect.attr = 1}) {
return %arg0 : f32
}
-// CHECK-LABEL: func @empty_tuple(tuple<>)
-func @empty_tuple(tuple<>)
+// CHECK-LABEL: func private @empty_tuple(tuple<>)
+func private @empty_tuple(tuple<>)
-// CHECK-LABEL: func @tuple_single_element(tuple<i32>)
-func @tuple_single_element(tuple<i32>)
+// CHECK-LABEL: func private @tuple_single_element(tuple<i32>)
+func private @tuple_single_element(tuple<i32>)
-// CHECK-LABEL: func @tuple_multi_element(tuple<i32, i16, f32>)
-func @tuple_multi_element(tuple<i32, i16, f32>)
+// CHECK-LABEL: func private @tuple_multi_element(tuple<i32, i16, f32>)
+func private @tuple_multi_element(tuple<i32, i16, f32>)
-// CHECK-LABEL: func @tuple_nested(tuple<tuple<tuple<i32>>>)
-func @tuple_nested(tuple<tuple<tuple<i32>>>)
+// CHECK-LABEL: func private @tuple_nested(tuple<tuple<tuple<i32>>>)
+func private @tuple_nested(tuple<tuple<tuple<i32>>>)
// CHECK-LABEL: func @pretty_form_multi_result
func @pretty_form_multi_result() -> (i16, i16) {
@@ -1168,11 +1168,11 @@ func @op_with_passthrough_region_args() {
return
}
-// CHECK-LABEL: func @ptr_to_function() -> !unreg.ptr<() -> ()>
-func @ptr_to_function() -> !unreg.ptr<() -> ()>
+// CHECK-LABEL: func private @ptr_to_function() -> !unreg.ptr<() -> ()>
+func private @ptr_to_function() -> !unreg.ptr<() -> ()>
-// CHECK-LABEL: func @escaped_string_char(i1 {foo.value = "\0A"})
-func @escaped_string_char(i1 {foo.value = "\n"})
+// CHECK-LABEL: func private @escaped_string_char(i1 {foo.value = "\0A"})
+func private @escaped_string_char(i1 {foo.value = "\n"})
// CHECK-LABEL: func @wrapped_keyword_test
func @wrapped_keyword_test() {
@@ -1188,13 +1188,13 @@ func @"\"_string_symbol_reference\""() {
return
}
-// CHECK-LABEL: func @string_attr_name
+// CHECK-LABEL: func private @string_attr_name
// CHECK-SAME: {"0 . 0", nested = {"0 . 0"}}
-func @string_attr_name() attributes {"0 . 0", nested = {"0 . 0"}}
+func private @string_attr_name() attributes {"0 . 0", nested = {"0 . 0"}}
-// CHECK-LABEL: func @nested_reference
+// CHECK-LABEL: func private @nested_reference
// CHECK: ref = @some_symbol::@some_nested_symbol
-func @nested_reference() attributes {test.ref = @some_symbol::@some_nested_symbol }
+func private @nested_reference() attributes {test.ref = @some_symbol::@some_nested_symbol }
// CHECK-LABEL: func @custom_asm_names
func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32, i32) {
diff --git a/mlir/test/IR/test-func-erase-result.mlir b/mlir/test/IR/test-func-erase-result.mlir
index bdd08475ef12..96ebffb9202b 100644
--- a/mlir/test/IR/test-func-erase-result.mlir
+++ b/mlir/test/IR/test-func-erase-result.mlir
@@ -1,32 +1,32 @@
// RUN: mlir-opt %s -test-func-erase-result -split-input-file | FileCheck %s
-// CHECK: func @f(){{$}}
+// CHECK: func private @f(){{$}}
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (f32 {test.erase_this_result})
+func private @f() -> (f32 {test.erase_this_result})
// -----
-// CHECK: func @f() -> (f32 {test.A})
+// CHECK: func private @f() -> (f32 {test.A})
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (
+func private @f() -> (
f32 {test.erase_this_result},
f32 {test.A}
)
// -----
-// CHECK: func @f() -> (f32 {test.A})
+// CHECK: func private @f() -> (f32 {test.A})
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (
+func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result}
)
// -----
-// CHECK: func @f() -> (f32 {test.A}, f32 {test.B})
+// CHECK: func private @f() -> (f32 {test.A}, f32 {test.B})
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (
+func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result},
f32 {test.B}
@@ -34,9 +34,9 @@ func @f() -> (
// -----
-// CHECK: func @f() -> (f32 {test.A}, f32 {test.B})
+// CHECK: func private @f() -> (f32 {test.A}, f32 {test.B})
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (
+func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result},
f32 {test.erase_this_result},
@@ -45,9 +45,9 @@ func @f() -> (
// -----
-// CHECK: func @f() -> (f32 {test.A}, f32 {test.B}, f32 {test.C})
+// CHECK: func private @f() -> (f32 {test.A}, f32 {test.B}, f32 {test.C})
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (
+func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result},
f32 {test.B},
@@ -57,9 +57,9 @@ func @f() -> (
// -----
-// CHECK: func @f() -> (tensor<1xf32>, tensor<2xf32>, tensor<3xf32>)
+// CHECK: func private @f() -> (tensor<1xf32>, tensor<2xf32>, tensor<3xf32>)
// CHECK-NOT: attributes{{.*}}result
-func @f() -> (
+func private @f() -> (
tensor<1xf32>,
f32 {test.erase_this_result},
tensor<2xf32>,
diff --git a/mlir/test/IR/test-func-set-type.mlir b/mlir/test/IR/test-func-set-type.mlir
index 032283ad705d..05a1393a8436 100644
--- a/mlir/test/IR/test-func-set-type.mlir
+++ b/mlir/test/IR/test-func-set-type.mlir
@@ -8,18 +8,18 @@
// Test case: The setType call needs to erase some arg attrs.
-// CHECK: func @erase_arg(f32 {test.A})
+// CHECK: func private @erase_arg(f32 {test.A})
// CHECK-NOT: attributes{{.*arg[0-9]}}
-func @t(f32)
-func @erase_arg(%arg0: f32 {test.A}, %arg1: f32 {test.B})
+func private @t(f32)
+func private @erase_arg(%arg0: f32 {test.A}, %arg1: f32 {test.B})
attributes {test.set_type_from = @t}
// -----
// Test case: The setType call needs to erase some result attrs.
-// CHECK: func @erase_result() -> (f32 {test.A})
+// CHECK: func private @erase_result() -> (f32 {test.A})
// CHECK-NOT: attributes{{.*result[0-9]}}
-func @t() -> (f32)
-func @erase_result() -> (f32 {test.A}, f32 {test.B})
+func private @t() -> (f32)
+func private @erase_result() -> (f32 {test.A}, f32 {test.B})
attributes {test.set_type_from = @t}
diff --git a/mlir/test/IR/test-symbol-rauw.mlir b/mlir/test/IR/test-symbol-rauw.mlir
index 2924c20df732..5d50bc0483b9 100644
--- a/mlir/test/IR/test-symbol-rauw.mlir
+++ b/mlir/test/IR/test-symbol-rauw.mlir
@@ -5,8 +5,8 @@
// CHECK: module
// CHECK-SAME: @symbol_foo
module attributes {sym.outside_use = @symbol_foo } {
- // CHECK: func @replaced_foo
- func @symbol_foo() attributes {sym.new_name = "replaced_foo" }
+ // CHECK: func private @replaced_foo
+ func private @symbol_foo() attributes {sym.new_name = "replaced_foo" }
// CHECK: func @symbol_bar
// CHECK: @replaced_foo
@@ -38,16 +38,16 @@ module attributes {sym.outside_use = @symbol_foo } {
module {
// CHECK: module @module_a
module @module_a {
- // CHECK: func @replaced_foo
- func @foo() attributes {sym.new_name = "replaced_foo" }
+ // CHECK: func nested @replaced_foo
+ func nested @foo() attributes {sym.new_name = "replaced_foo" }
}
// CHECK: module @replaced_module_b
module @module_b attributes {sym.new_name = "replaced_module_b"} {
// CHECK: module @replaced_module_c
module @module_c attributes {sym.new_name = "replaced_module_c"} {
- // CHECK: func @replaced_foo
- func @foo() attributes {sym.new_name = "replaced_foo" }
+ // CHECK: func nested @replaced_foo
+ func nested @foo() attributes {sym.new_name = "replaced_foo" }
}
}
@@ -67,8 +67,8 @@ module {
// Check that the replacement fails for potentially unknown symbol tables.
module {
- // CHECK: func @failed_repl
- func @failed_repl() attributes {sym.new_name = "replaced_name" }
+ // CHECK: func private @failed_repl
+ func private @failed_repl() attributes {sym.new_name = "replaced_name" }
"foo.possibly_unknown_symbol_table"() ({
}) : () -> ()
diff --git a/mlir/test/IR/test-symbol-uses.mlir b/mlir/test/IR/test-symbol-uses.mlir
index 17f4a3054f9f..36c52c88756c 100644
--- a/mlir/test/IR/test-symbol-uses.mlir
+++ b/mlir/test/IR/test-symbol-uses.mlir
@@ -5,7 +5,7 @@
// expected-remark at below {{symbol_removable function successfully erased}}
module attributes {sym.outside_use = @symbol_foo } {
// expected-remark at +1 {{symbol has 2 uses}}
- func @symbol_foo()
+ func private @symbol_foo()
// expected-remark at below {{symbol has no uses}}
// expected-remark at below {{found use of symbol : @symbol_foo}}
@@ -20,10 +20,10 @@ module attributes {sym.outside_use = @symbol_foo } {
}
// expected-remark at below {{symbol has no uses}}
- func @symbol_removable()
+ func private @symbol_removable()
// expected-remark at +1 {{symbol has 1 use}}
- func @symbol_baz()
+ func private @symbol_baz()
// expected-remark at +1 {{found use of symbol : @symbol_baz}}
module attributes {test.reference = @symbol_baz} {
@@ -40,7 +40,7 @@ module {
// expected-remark at +1 {{symbol has 1 uses}}
module @module_c {
// expected-remark at +1 {{symbol has 1 uses}}
- func @foo()
+ func nested @foo()
}
}
diff --git a/mlir/test/IR/traits.mlir b/mlir/test/IR/traits.mlir
index 4dd6ef7dcf37..88762812e311 100644
--- a/mlir/test/IR/traits.mlir
+++ b/mlir/test/IR/traits.mlir
@@ -344,11 +344,11 @@ func @failedSingleBlockImplicitTerminator_missing_terminator() {
// Test that operation with the SymbolTable Trait define a new symbol scope.
"test.symbol_scope"() ({
- func @foo() {
+ func private @foo() {
}
"test.finish" () : () -> ()
}) : () -> ()
-func @foo() {
+func private @foo() {
}
// -----
diff --git a/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir b/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir
index 8885dab80538..57a1f31d84a9 100644
--- a/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir
+++ b/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir
@@ -6,6 +6,6 @@
module {
module @inner_mod1 {
"test.symbol"() {sym_name = "foo"} : () -> ()
- func @bar()
+ func private @bar()
}
}
diff --git a/mlir/test/Pass/dynamic-pipeline-nested.mlir b/mlir/test/Pass/dynamic-pipeline-nested.mlir
index 7651ff403348..9e0945b28e06 100644
--- a/mlir/test/Pass/dynamic-pipeline-nested.mlir
+++ b/mlir/test/Pass/dynamic-pipeline-nested.mlir
@@ -20,9 +20,9 @@ module @inner_mod1 {
// CHECK: Dump Before CSE
// NOTNESTED-NEXT: @inner_mod1
// NESTED-NEXT: @foo
- func @foo()
+ func private @foo()
// Only in the nested case we have a second run of the pass here.
// NESTED: Dump Before CSE
// NESTED-NEXT: @baz
- func @baz()
+ func private @baz()
}
diff --git a/mlir/test/Transforms/buffer-results-to-out-params.mlir b/mlir/test/Transforms/buffer-results-to-out-params.mlir
index 9eb794abfa2f..cde929739475 100644
--- a/mlir/test/Transforms/buffer-results-to-out-params.mlir
+++ b/mlir/test/Transforms/buffer-results-to-out-params.mlir
@@ -47,17 +47,17 @@ func @non_memref_types() -> (i1, memref<f32>, i32) {
return %0, %1, %2 : i1, memref<f32>, i32
}
-// CHECK: func @external_function(memref<f32>)
-func @external_function() -> (memref<f32>)
-// CHECK: func @result_attrs(memref<f32> {test.some_attr})
-func @result_attrs() -> (memref<f32> {test.some_attr})
-// CHECK: func @mixed_result_attrs(memref<1xf32>, memref<2xf32> {test.some_attr}, memref<3xf32>)
-func @mixed_result_attrs() -> (memref<1xf32>, memref<2xf32> {test.some_attr}, memref<3xf32>)
+// CHECK: func private @external_function(memref<f32>)
+func private @external_function() -> (memref<f32>)
+// CHECK: func private @result_attrs(memref<f32> {test.some_attr})
+func private @result_attrs() -> (memref<f32> {test.some_attr})
+// CHECK: func private @mixed_result_attrs(memref<1xf32>, memref<2xf32> {test.some_attr}, memref<3xf32>)
+func private @mixed_result_attrs() -> (memref<1xf32>, memref<2xf32> {test.some_attr}, memref<3xf32>)
// -----
-// CHECK-LABEL: func @callee(memref<1xf32>)
-func @callee() -> memref<1xf32>
+// CHECK-LABEL: func private @callee(memref<1xf32>)
+func private @callee() -> memref<1xf32>
// CHECK-LABEL: func @call_basic() {
// CHECK: %[[OUTPARAM:.*]] = alloc() : memref<1xf32>
@@ -73,8 +73,8 @@ func @call_basic() {
// -----
-// CHECK-LABEL: func @callee(memref<1xf32>, memref<2xf32>)
-func @callee() -> (memref<1xf32>, memref<2xf32>)
+// CHECK-LABEL: func private @callee(memref<1xf32>, memref<2xf32>)
+func private @callee() -> (memref<1xf32>, memref<2xf32>)
// CHECK-LABEL: func @call_multiple_result() {
// CHECK: %[[RESULT0:.*]] = alloc() : memref<1xf32>
@@ -89,8 +89,8 @@ func @call_multiple_result() {
// -----
-// CHECK-LABEL: func @callee(memref<1xf32>) -> (i1, i32)
-func @callee() -> (i1, memref<1xf32>, i32)
+// CHECK-LABEL: func private @callee(memref<1xf32>) -> (i1, i32)
+func private @callee() -> (i1, memref<1xf32>, i32)
// CHECK-LABEL: func @call_non_memref_result() {
// CHECK: %[[RESULT0:.*]] = alloc() : memref<1xf32>
@@ -104,7 +104,7 @@ func @call_non_memref_result() {
// -----
-func @callee() -> (memref<?xf32>)
+func private @callee() -> (memref<?xf32>)
func @call_non_memref_result() {
// expected-error @+1 {{cannot create out param for dynamically shaped result}}
diff --git a/mlir/test/Transforms/decompose-call-graph-types.mlir b/mlir/test/Transforms/decompose-call-graph-types.mlir
index c29bbdd2bd9e..850bf5e9ecfa 100644
--- a/mlir/test/Transforms/decompose-call-graph-types.mlir
+++ b/mlir/test/Transforms/decompose-call-graph-types.mlir
@@ -39,8 +39,8 @@ func @recursive_decomposition(%arg0: tuple<tuple<tuple<i1>>>) -> tuple<tuple<tup
// Test case: Check decomposition of calls.
-// CHECK-LABEL: func @callee(i1, i32) -> (i1, i32)
-func @callee(tuple<i1, i32>) -> tuple<i1, i32>
+// CHECK-LABEL: func private @callee(i1, i32) -> (i1, i32)
+func private @callee(tuple<i1, i32>) -> tuple<i1, i32>
// CHECK-LABEL: func @caller(
// CHECK-SAME: %[[ARG0:.*]]: i1,
@@ -62,8 +62,8 @@ func @caller(%arg0: tuple<i1, i32>) -> tuple<i1, i32> {
// Test case: Type that decomposes to nothing (that is, a 1:0 decomposition).
-// CHECK-LABEL: func @callee()
-func @callee(tuple<>) -> tuple<>
+// CHECK-LABEL: func private @callee()
+func private @callee(tuple<>) -> tuple<>
// CHECK-LABEL: func @caller() {
// CHECK: call @callee() : () -> ()
// CHECK: return
@@ -92,8 +92,8 @@ func @unconverted_op_result() -> tuple<i1, i32> {
// Test case: Check mixed decomposed and non-decomposed args.
// This makes sure to test the cases if 1:0, 1:1, and 1:N decompositions.
-// CHECK-LABEL: func @callee(i1, i2, i3, i4, i5, i6) -> (i1, i2, i3, i4, i5, i6)
-func @callee(tuple<>, i1, tuple<i2>, i3, tuple<i4, i5>, i6) -> (tuple<>, i1, tuple<i2>, i3, tuple<i4, i5>, i6)
+// CHECK-LABEL: func private @callee(i1, i2, i3, i4, i5, i6) -> (i1, i2, i3, i4, i5, i6)
+func private @callee(tuple<>, i1, tuple<i2>, i3, tuple<i4, i5>, i6) -> (tuple<>, i1, tuple<i2>, i3, tuple<i4, i5>, i6)
// CHECK-LABEL: func @caller(
// CHECK-SAME: %[[I1:.*]]: i1,
diff --git a/mlir/test/Transforms/inlining.mlir b/mlir/test/Transforms/inlining.mlir
index e59d8094768b..be9aa9cfc55b 100644
--- a/mlir/test/Transforms/inlining.mlir
+++ b/mlir/test/Transforms/inlining.mlir
@@ -64,8 +64,8 @@ func @inline_with_locations(%arg0 : i32) -> i32 {
}
-// Check that external functions are not inlined.
-func @func_external()
+// Check that external function declarations are not inlined.
+func private @func_external()
// CHECK-LABEL: func @no_inline_external
func @no_inline_external() {
diff --git a/mlir/test/Transforms/normalize-memrefs.mlir b/mlir/test/Transforms/normalize-memrefs.mlir
index 9c1e610c483a..7bdbfe6bfb35 100644
--- a/mlir/test/Transforms/normalize-memrefs.mlir
+++ b/mlir/test/Transforms/normalize-memrefs.mlir
@@ -294,13 +294,13 @@ func @some_func_C(%A: memref<8xf64, #tile>) {
}
// Test case set #7: Check normalization in case of external functions.
-// CHECK-LABEL: func @external_func_A
+// CHECK-LABEL: func private @external_func_A
// CHECK-SAME: (memref<4x4xf64>)
-func @external_func_A(memref<16xf64, #tile>) -> ()
+func private @external_func_A(memref<16xf64, #tile>) -> ()
-// CHECK-LABEL: func @external_func_B
+// CHECK-LABEL: func private @external_func_B
// CHECK-SAME: (memref<4x4xf64>, f64) -> memref<2x4xf64>
-func @external_func_B(memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>)
+func private @external_func_B(memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>)
// CHECK-LABEL: func @simply_call_external()
func @simply_call_external() {
diff --git a/mlir/test/Transforms/sccp-callgraph.mlir b/mlir/test/Transforms/sccp-callgraph.mlir
index 4b81fad9b3c7..58279e7ba329 100644
--- a/mlir/test/Transforms/sccp-callgraph.mlir
+++ b/mlir/test/Transforms/sccp-callgraph.mlir
@@ -204,7 +204,7 @@ func private @complex_inner_if(%arg0 : i32) -> i32 {
return %arg_inc : i32
}
-func @complex_cond() -> i1
+func private @complex_cond() -> i1
// CHECK-LABEL: func private @complex_callee(
func private @complex_callee(%arg0 : i32) -> i32 {
diff --git a/mlir/test/Transforms/sccp.mlir b/mlir/test/Transforms/sccp.mlir
index 43a6ff5357cc..382ea5e39921 100644
--- a/mlir/test/Transforms/sccp.mlir
+++ b/mlir/test/Transforms/sccp.mlir
@@ -90,7 +90,7 @@ func @unknown_terminator(%arg0 : i32, %arg1 : i1) -> i32 {
/// Check that arguments are properly merged across loop-like control flow.
-func @ext_cond_fn() -> i1
+func private @ext_cond_fn() -> i1
// CHECK-LABEL: func @simple_loop
func @simple_loop(%arg0 : i32, %cond1 : i1) -> i32 {
@@ -161,7 +161,7 @@ func @simple_loop_inner_control_flow(%arg0 : i32) -> i32 {
/// Check that arguments go to overdefined when loop backedges produce a
/// conflicting value.
-func @ext_cond_and_value_fn() -> (i1, i32)
+func private @ext_cond_and_value_fn() -> (i1, i32)
// CHECK-LABEL: func @simple_loop_overdefined
func @simple_loop_overdefined(%arg0 : i32, %cond1 : i1) -> i32 {
diff --git a/mlir/test/Transforms/test-convert-call-op.mlir b/mlir/test/Transforms/test-convert-call-op.mlir
index d1a1d5c35812..ea6b6a1d2469 100644
--- a/mlir/test/Transforms/test-convert-call-op.mlir
+++ b/mlir/test/Transforms/test-convert-call-op.mlir
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -test-convert-call-op | FileCheck %s
// CHECK-LABEL: llvm.func @callee(!llvm.ptr<i8>) -> !llvm.i32
-func @callee(!test.test_type) -> i32
+func private @callee(!test.test_type) -> i32
// CHECK-NEXT: llvm.func @caller() -> !llvm.i32
func @caller() -> i32 {
diff --git a/mlir/test/Transforms/test-legalizer.mlir b/mlir/test/Transforms/test-legalizer.mlir
index 3a04ebfcea6d..878d903bfa18 100644
--- a/mlir/test/Transforms/test-legalizer.mlir
+++ b/mlir/test/Transforms/test-legalizer.mlir
@@ -16,8 +16,8 @@ func @verifyLargerBenefit() -> i32 {
return %result : i32
}
-// CHECK-LABEL: func @remap_input_1_to_0()
-func @remap_input_1_to_0(i16)
+// CHECK-LABEL: func private @remap_input_1_to_0()
+func private @remap_input_1_to_0(i16)
// CHECK-LABEL: func @remap_input_1_to_1(%arg0: f64)
func @remap_input_1_to_1(%arg0: i64) {
diff --git a/mlir/test/Transforms/test-symbol-dce.mlir b/mlir/test/Transforms/test-symbol-dce.mlir
index 08b87ff4ae9f..e2d6ee124146 100644
--- a/mlir/test/Transforms/test-symbol-dce.mlir
+++ b/mlir/test/Transforms/test-symbol-dce.mlir
@@ -21,9 +21,6 @@ module attributes {test.simple} {
func @public_function() {
"foo.return"() {uses = [@live_private_function, @live_nested_function]} : () -> ()
}
-
- // CHECK: func public @public_function_explicit
- func public @public_function_explicit()
}
// -----
diff --git a/mlir/test/mlir-cpu-runner/async-group.mlir b/mlir/test/mlir-cpu-runner/async-group.mlir
index 0ae378b45be1..87004ff7b381 100644
--- a/mlir/test/mlir-cpu-runner/async-group.mlir
+++ b/mlir/test/mlir-cpu-runner/async-group.mlir
@@ -37,4 +37,4 @@ func @main() {
return
}
-func @mlirAsyncRuntimePrintCurrentThreadId() -> ()
+func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
diff --git a/mlir/test/mlir-cpu-runner/async.mlir b/mlir/test/mlir-cpu-runner/async.mlir
index 9ec4de98cc6b..fd0268e7ac56 100644
--- a/mlir/test/mlir-cpu-runner/async.mlir
+++ b/mlir/test/mlir-cpu-runner/async.mlir
@@ -79,6 +79,6 @@ func @main() {
return
}
-func @mlirAsyncRuntimePrintCurrentThreadId() -> ()
+func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
-func @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
+func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
diff --git a/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir b/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
index 6dc8b5576251..9934083fb11a 100644
--- a/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
+++ b/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
@@ -28,9 +28,9 @@ func @simple_add1_add2_test(%arg0: memref<2xf32>, %arg1: memref<2xf32>) {
// External declarations.
llvm.func @malloc(!llvm.i64) -> !llvm.ptr<i8>
llvm.func @free(!llvm.ptr<i8>)
-func @printF32(%arg0: f32)
-func @printComma()
-func @printNewline()
+func private @printF32(%arg0: f32)
+func private @printComma()
+func private @printNewline()
func @main()
{
diff --git a/mlir/test/mlir-cpu-runner/global_memref.mlir b/mlir/test/mlir-cpu-runner/global_memref.mlir
index 1c9cf4a33aeb..5dbd75a62a50 100644
--- a/mlir/test/mlir-cpu-runner/global_memref.mlir
+++ b/mlir/test/mlir-cpu-runner/global_memref.mlir
@@ -1,8 +1,8 @@
// RUN: mlir-opt %s -convert-std-to-llvm | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
-func @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
-func @print_memref_i32(memref<*xi32>) attributes { llvm.emit_c_interface }
-func @printNewline() -> ()
+func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
+func private @print_memref_i32(memref<*xi32>) attributes { llvm.emit_c_interface }
+func private @printNewline() -> ()
global_memref "private" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]>
func @test1DMemref() {
diff --git a/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir b/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
index 4f933a7784cb..62a252988c96 100644
--- a/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
+++ b/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
@@ -3,7 +3,7 @@
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
+func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
func @main() -> () {
%c0 = constant 0 : index
diff --git a/mlir/test/mlir-cpu-runner/memref_reshape.mlir b/mlir/test/mlir-cpu-runner/memref_reshape.mlir
index 7832a82595e7..aa031802350c 100644
--- a/mlir/test/mlir-cpu-runner/memref_reshape.mlir
+++ b/mlir/test/mlir-cpu-runner/memref_reshape.mlir
@@ -4,7 +4,7 @@
// RUN: | FileCheck %s
-func @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
+func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
func @main() -> () {
%c0 = constant 0 : index
diff --git a/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir b/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
index c6eab3d9b984..742a2385f002 100644
--- a/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
+++ b/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
@@ -69,6 +69,6 @@ func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: mem
return
}
-func @print_flops(f64)
-func @rtclock() -> f64
-func @print_memref_f32(memref<*xf32>)
+func private @print_flops(f64)
+func private @rtclock() -> f64
+func private @print_memref_f32(memref<*xf32>)
diff --git a/mlir/test/mlir-cpu-runner/unranked_memref.mlir b/mlir/test/mlir-cpu-runner/unranked_memref.mlir
index c950bfd3547c..eecce9d37603 100644
--- a/mlir/test/mlir-cpu-runner/unranked_memref.mlir
+++ b/mlir/test/mlir-cpu-runner/unranked_memref.mlir
@@ -70,8 +70,8 @@ func @main() -> () {
return
}
-func @print_memref_i8(memref<*xi8>) attributes { llvm.emit_c_interface }
-func @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
+func private @print_memref_i8(memref<*xi8>) attributes { llvm.emit_c_interface }
+func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
func @return_two_var_memref_caller() {
%0 = alloca() : memref<4x3xf32>
@@ -102,8 +102,8 @@ func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> {
return %0 : memref<*xf32>
}
-func @printU64(index) -> ()
-func @printNewline() -> ()
+func private @printU64(index) -> ()
+func private @printNewline() -> ()
func @dim_op_of_unranked() {
%ranked = alloc() : memref<4x3xf32>
diff --git a/mlir/test/mlir-cpu-runner/utils.mlir b/mlir/test/mlir-cpu-runner/utils.mlir
index 65957400bf7f..971d348ae48b 100644
--- a/mlir/test/mlir-cpu-runner/utils.mlir
+++ b/mlir/test/mlir-cpu-runner/utils.mlir
@@ -49,7 +49,7 @@ func @print_3d() {
// PRINT-3D-NEXT: 2, 2, 4, 2, 2
// PRINT-3D-NEXT: 2, 2, 2, 2, 2
-func @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
+func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
!vector_type_C = type vector<4x4xf32>
!matrix_type_CC = type memref<1x1x!vector_type_C>
@@ -70,4 +70,4 @@ func @vector_splat_2d() {
// PRINT-VECTOR-SPLAT-2D: Memref base@ = {{.*}} rank = 2 offset = 0 sizes = [1, 1] strides = [1, 1] data =
// PRINT-VECTOR-SPLAT-2D-NEXT: [((10, 10, 10, 10), (10, 10, 10, 10), (10, 10, 10, 10), (10, 10, 10, 10))]
-func @print_memref_vector_4x4xf32(memref<?x?x!vector_type_C>) attributes { llvm.emit_c_interface }
+func private @print_memref_vector_4x4xf32(memref<?x?x!vector_type_C>) attributes { llvm.emit_c_interface }
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-and.mlir b/mlir/test/mlir-cuda-runner/all-reduce-and.mlir
index ef8d50580d9e..9096cfeda563 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-and.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-and.mlir
@@ -58,5 +58,5 @@ func @main() {
return
}
-func @print_memref_i32(memref<*xi32>)
+func private @print_memref_i32(memref<*xi32>)
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-max.mlir b/mlir/test/mlir-cuda-runner/all-reduce-max.mlir
index be8087a55ea2..68dbf046ef4c 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-max.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-max.mlir
@@ -58,5 +58,5 @@ func @main() {
return
}
-func @print_memref_i32(memref<*xi32>)
+func private @print_memref_i32(memref<*xi32>)
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-min.mlir b/mlir/test/mlir-cuda-runner/all-reduce-min.mlir
index ad03ed5497f0..d078d9231958 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-min.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-min.mlir
@@ -58,5 +58,5 @@ func @main() {
return
}
-func @print_memref_i32(memref<*xi32>)
+func private @print_memref_i32(memref<*xi32>)
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-op.mlir b/mlir/test/mlir-cuda-runner/all-reduce-op.mlir
index a639c699027b..247d2c599db2 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-op.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-op.mlir
@@ -28,4 +28,4 @@ func @main() {
return
}
-func @print_memref_f32(%ptr : memref<*xf32>)
+func private @print_memref_f32(%ptr : memref<*xf32>)
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-or.mlir b/mlir/test/mlir-cuda-runner/all-reduce-or.mlir
index 1ed85e61ded5..c6a5ee5a1096 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-or.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-or.mlir
@@ -58,5 +58,5 @@ func @main() {
return
}
-func @print_memref_i32(memref<*xi32>)
+func private @print_memref_i32(memref<*xi32>)
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-region.mlir b/mlir/test/mlir-cuda-runner/all-reduce-region.mlir
index 49f24db131c7..dcff9d00e4cf 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-region.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-region.mlir
@@ -25,4 +25,4 @@ func @main() {
return
}
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
diff --git a/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir b/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir
index 88cd9036998f..9ca81dff02f9 100644
--- a/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir
+++ b/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir
@@ -58,5 +58,5 @@ func @main() {
return
}
-func @print_memref_i32(memref<*xi32>)
+func private @print_memref_i32(memref<*xi32>)
diff --git a/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir b/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir
index fb458eb375d0..e2340bd1f5fa 100644
--- a/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir
+++ b/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir
@@ -26,4 +26,4 @@ func @main() {
return
}
-func @print_memref_f32(%ptr : memref<*xf32>)
+func private @print_memref_f32(%ptr : memref<*xf32>)
diff --git a/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir b/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir
index f3fb3b219ce0..44278791592a 100644
--- a/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir
+++ b/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir
@@ -66,4 +66,4 @@ func @main() {
return
}
-func @print_memref_f32(memref<*xf32>)
+func private @print_memref_f32(memref<*xf32>)
diff --git a/mlir/test/mlir-cuda-runner/shuffle.mlir b/mlir/test/mlir-cuda-runner/shuffle.mlir
index 9846455142d6..b1fde24706ba 100644
--- a/mlir/test/mlir-cuda-runner/shuffle.mlir
+++ b/mlir/test/mlir-cuda-runner/shuffle.mlir
@@ -28,4 +28,4 @@ func @main() {
return
}
-func @print_memref_f32(%ptr : memref<*xf32>)
+func private @print_memref_f32(%ptr : memref<*xf32>)
diff --git a/mlir/test/mlir-cuda-runner/two-modules.mlir b/mlir/test/mlir-cuda-runner/two-modules.mlir
index 2ea58ae55b5e..982e8aa4f393 100644
--- a/mlir/test/mlir-cuda-runner/two-modules.mlir
+++ b/mlir/test/mlir-cuda-runner/two-modules.mlir
@@ -25,4 +25,4 @@ func @main() {
return
}
-func @print_memref_i32(%memref : memref<*xi32>)
+func private @print_memref_i32(%memref : memref<*xi32>)
diff --git a/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir b/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir
index 68e31fede8dc..14447743812d 100644
--- a/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir
+++ b/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir
@@ -28,5 +28,5 @@ func @main() {
return
}
-func @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
-func @print_memref_f32(%ptr : memref<*xf32>)
+func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
+func private @print_memref_f32(%ptr : memref<*xf32>)
diff --git a/mlir/test/mlir-rocm-runner/vecadd.mlir b/mlir/test/mlir-rocm-runner/vecadd.mlir
index 9063974d5124..43c5e92cd597 100644
--- a/mlir/test/mlir-rocm-runner/vecadd.mlir
+++ b/mlir/test/mlir-rocm-runner/vecadd.mlir
@@ -46,5 +46,5 @@ func @main() {
return
}
-func @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
-func @print_memref_f32(%ptr : memref<*xf32>)
+func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
+func private @print_memref_f32(%ptr : memref<*xf32>)
diff --git a/mlir/test/mlir-rocm-runner/vector-transferops.mlir b/mlir/test/mlir-rocm-runner/vector-transferops.mlir
index 3d4424cc4281..87a05c564c5a 100644
--- a/mlir/test/mlir-rocm-runner/vector-transferops.mlir
+++ b/mlir/test/mlir-rocm-runner/vector-transferops.mlir
@@ -80,5 +80,5 @@ func @main() {
return
}
-func @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
-func @print_memref_f32(%ptr : memref<*xf32>)
+func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
+func private @print_memref_f32(%ptr : memref<*xf32>)
diff --git a/mlir/test/mlir-spirv-cpu-runner/double.mlir b/mlir/test/mlir-spirv-cpu-runner/double.mlir
index 77a07b49292d..dd4a49c78d47 100644
--- a/mlir/test/mlir-spirv-cpu-runner/double.mlir
+++ b/mlir/test/mlir-spirv-cpu-runner/double.mlir
@@ -62,6 +62,6 @@ module attributes {
return
}
- func @fillI32Buffer(%arg0 : memref<?xi32>, %arg1 : i32)
- func @print_memref_i32(%ptr : memref<*xi32>)
+ func private @fillI32Buffer(%arg0 : memref<?xi32>, %arg1 : i32)
+ func private @print_memref_i32(%ptr : memref<*xi32>)
}
diff --git a/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir b/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
index 18b6390d6bb7..278ddcad113d 100644
--- a/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
+++ b/mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
@@ -54,8 +54,8 @@ module attributes {
call @print_memref_f32(%result) : (memref<*xf32>) -> ()
return
}
- func @fillF32Buffer1D(%arg0 : memref<?xf32>, %arg1 : f32)
- func @fillF32Buffer2D(%arg0 : memref<?x?xf32>, %arg1 : f32)
- func @fillF32Buffer3D(%arg0 : memref<?x?x?xf32>, %arg1 : f32)
- func @print_memref_f32(%arg0 : memref<*xf32>)
+ func private @fillF32Buffer1D(%arg0 : memref<?xf32>, %arg1 : f32)
+ func private @fillF32Buffer2D(%arg0 : memref<?x?xf32>, %arg1 : f32)
+ func private @fillF32Buffer3D(%arg0 : memref<?x?x?xf32>, %arg1 : f32)
+ func private @print_memref_f32(%arg0 : memref<*xf32>)
}
diff --git a/mlir/test/mlir-vulkan-runner/addf.mlir b/mlir/test/mlir-vulkan-runner/addf.mlir
index 490ed2f20f25..e7ee7cb2e853 100644
--- a/mlir/test/mlir-vulkan-runner/addf.mlir
+++ b/mlir/test/mlir-vulkan-runner/addf.mlir
@@ -44,7 +44,7 @@ module attributes {
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
return
}
- func @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
- func @print_memref_f32(%ptr : memref<*xf32>)
+ func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
+ func private @print_memref_f32(%ptr : memref<*xf32>)
}
diff --git a/mlir/test/mlir-vulkan-runner/addi.mlir b/mlir/test/mlir-vulkan-runner/addi.mlir
index 6b289cdb7290..81ac4a98eaae 100644
--- a/mlir/test/mlir-vulkan-runner/addi.mlir
+++ b/mlir/test/mlir-vulkan-runner/addi.mlir
@@ -43,9 +43,9 @@ module attributes {
call @print_memref_i32(%arg6) : (memref<*xi32>) -> ()
return
}
- func @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
- func @fillResource2DInt(%0 : memref<?x?xi32>, %1 : i32)
- func @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
- func @print_memref_i32(%ptr : memref<*xi32>)
+ func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
+ func private @fillResource2DInt(%0 : memref<?x?xi32>, %1 : i32)
+ func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
+ func private @print_memref_i32(%ptr : memref<*xi32>)
}
diff --git a/mlir/test/mlir-vulkan-runner/addi8.mlir b/mlir/test/mlir-vulkan-runner/addi8.mlir
index 27bfa7d02396..920d6a9f6084 100644
--- a/mlir/test/mlir-vulkan-runner/addi8.mlir
+++ b/mlir/test/mlir-vulkan-runner/addi8.mlir
@@ -44,8 +44,8 @@ module attributes {
call @print_memref_i32(%arg6) : (memref<*xi32>) -> ()
return
}
- func @fillResource1DInt8(%0 : memref<?xi8>, %1 : i8)
- func @fillResource2DInt8(%0 : memref<?x?xi8>, %1 : i8)
- func @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
- func @print_memref_i32(%ptr : memref<*xi32>)
+ func private @fillResource1DInt8(%0 : memref<?xi8>, %1 : i8)
+ func private @fillResource2DInt8(%0 : memref<?x?xi8>, %1 : i8)
+ func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
+ func private @print_memref_i32(%ptr : memref<*xi32>)
}
diff --git a/mlir/test/mlir-vulkan-runner/mulf.mlir b/mlir/test/mlir-vulkan-runner/mulf.mlir
index a6b7b1b23e5d..e908d6672e03 100644
--- a/mlir/test/mlir-vulkan-runner/mulf.mlir
+++ b/mlir/test/mlir-vulkan-runner/mulf.mlir
@@ -45,7 +45,7 @@ module attributes {
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
return
}
- func @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
- func @print_memref_f32(%ptr : memref<*xf32>)
+ func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
+ func private @print_memref_f32(%ptr : memref<*xf32>)
}
diff --git a/mlir/test/mlir-vulkan-runner/subf.mlir b/mlir/test/mlir-vulkan-runner/subf.mlir
index 00940688eb16..02ed80f91900 100644
--- a/mlir/test/mlir-vulkan-runner/subf.mlir
+++ b/mlir/test/mlir-vulkan-runner/subf.mlir
@@ -47,7 +47,7 @@ module attributes {
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
return
}
- func @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
- func @fillResource3DFloat(%0 : memref<?x?x?xf32>, %1 : f32)
- func @print_memref_f32(%ptr : memref<*xf32>)
+ func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
+ func private @fillResource3DFloat(%0 : memref<?x?x?xf32>, %1 : f32)
+ func private @print_memref_f32(%ptr : memref<*xf32>)
}
diff --git a/mlir/test/mlir-vulkan-runner/time.mlir b/mlir/test/mlir-vulkan-runner/time.mlir
index 0bf92966cdec..be8ce0f54361 100644
--- a/mlir/test/mlir-vulkan-runner/time.mlir
+++ b/mlir/test/mlir-vulkan-runner/time.mlir
@@ -50,7 +50,7 @@ module attributes {
%arg6 = memref_cast %arg5 : memref<?xf32> to memref<*xf32>
return
}
- func @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
- func @print_memref_f32(%ptr : memref<*xf32>)
+ func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
+ func private @print_memref_f32(%ptr : memref<*xf32>)
}
diff --git a/mlir/unittests/Pass/AnalysisManagerTest.cpp b/mlir/unittests/Pass/AnalysisManagerTest.cpp
index 55f953aacaff..3ea88b0f9843 100644
--- a/mlir/unittests/Pass/AnalysisManagerTest.cpp
+++ b/mlir/unittests/Pass/AnalysisManagerTest.cpp
@@ -58,6 +58,7 @@ TEST(AnalysisManagerTest, FineGrainFunctionAnalysisPreservation) {
FuncOp func1 =
FuncOp::create(builder.getUnknownLoc(), "foo",
builder.getFunctionType(llvm::None, llvm::None));
+ func1.setPrivate();
module->push_back(func1);
// Test fine grain invalidation of the function analysis manager.
@@ -87,6 +88,7 @@ TEST(AnalysisManagerTest, FineGrainChildFunctionAnalysisPreservation) {
FuncOp func1 =
FuncOp::create(builder.getUnknownLoc(), "foo",
builder.getFunctionType(llvm::None, llvm::None));
+ func1.setPrivate();
module->push_back(func1);
// Test fine grain invalidation of a function analysis from within a module
diff --git a/mlir/unittests/Pass/PassManagerTest.cpp b/mlir/unittests/Pass/PassManagerTest.cpp
index cf32fe9e424f..d47ba581e728 100644
--- a/mlir/unittests/Pass/PassManagerTest.cpp
+++ b/mlir/unittests/Pass/PassManagerTest.cpp
@@ -54,6 +54,7 @@ TEST(PassManagerTest, OpSpecificAnalysis) {
FuncOp func =
FuncOp::create(builder.getUnknownLoc(), name,
builder.getFunctionType(llvm::None, llvm::None));
+ func.setPrivate();
module->push_back(func);
}
More information about the Mlir-commits
mailing list