[Mlir-commits] [mlir] [mlir][func]: Introduce ReplaceFuncSignature tranform operation (PR #143381)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Tue Jun 10 13:47:31 PDT 2025
================
@@ -0,0 +1,42 @@
+//===- Utils.h - General Func transformation utilities ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This header file defines prototypes for various transformation utilities for
+// the Func dialect. These are not passes by themselves but are used
+// either by passes, optimization sequences, or in turn by other transformation
+// utilities.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_FUNC_UTILS_H
+#define MLIR_DIALECT_FUNC_UTILS_H
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+
+namespace mlir {
+
+namespace func {
+
+// Creates a new function operation with the same name as the original
+// function operation, but with the arguments reordered according to
+// the `newArgsOrder` and `newResultsOrder`.
+mlir::func::FuncOp replaceFuncWithNewOrder(mlir::func::FuncOp funcOp,
+ mlir::ArrayRef<int> newArgsOrder,
+ mlir::ArrayRef<int> newResultsOrder);
----------------
ftynse wrote:
```suggestion
FuncOp replaceFuncWithNewOrder(FuncOp funcOp,
ArrayRef<int> newArgsOrder,
ArrayRef<int> newResultsOrder);
```
No need to prefix types for declarations that are in the namespace.
https://github.com/llvm/llvm-project/pull/143381
More information about the Mlir-commits
mailing list