[Mlir-commits] [mlir] fce529f - Fix `insertFunctionArguments()` block argument order.
Christian Sigg
llvmlistbot at llvm.org
Fri Nov 5 02:08:29 PDT 2021
Author: Christian Sigg
Date: 2021-11-05T10:08:20+01:00
New Revision: fce529fc6e83dc045fab1715734aecdde962ec2e
URL: https://github.com/llvm/llvm-project/commit/fce529fc6e83dc045fab1715734aecdde962ec2e
DIFF: https://github.com/llvm/llvm-project/commit/fce529fc6e83dc045fab1715734aecdde962ec2e.diff
LOG: Fix `insertFunctionArguments()` block argument order.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D113171
Added:
Modified:
mlir/lib/IR/FunctionSupport.cpp
mlir/test/IR/test-func-insert-arg.mlir
Removed:
################################################################################
diff --git a/mlir/lib/IR/FunctionSupport.cpp b/mlir/lib/IR/FunctionSupport.cpp
index 4f6f76cfbcfb9..d67d277f69d31 100644
--- a/mlir/lib/IR/FunctionSupport.cpp
+++ b/mlir/lib/IR/FunctionSupport.cpp
@@ -164,7 +164,7 @@ void mlir::function_like_impl::insertFunctionArguments(
// Update the function type and any entry block arguments.
op->setAttr(getTypeAttrName(), TypeAttr::get(newType));
for (unsigned i = 0, e = argIndices.size(); i < e; ++i)
- entry.insertArgument(argIndices[i], argTypes[i],
+ entry.insertArgument(argIndices[i] + i, argTypes[i],
argLocs.empty() ? Optional<Location>{} : argLocs[i]);
}
diff --git a/mlir/test/IR/test-func-insert-arg.mlir b/mlir/test/IR/test-func-insert-arg.mlir
index 2de6c666d0d31..61308a1862b38 100644
--- a/mlir/test/IR/test-func-insert-arg.mlir
+++ b/mlir/test/IR/test-func-insert-arg.mlir
@@ -1,49 +1,49 @@
// RUN: mlir-opt %s -test-func-insert-arg -split-input-file | FileCheck %s
-// CHECK: func @f(%arg0: f32 {test.A})
+// CHECK: func @f(%arg0: i1 {test.A})
func @f() attributes {test.insert_args = [
- [0, f32, {test.A}]]} {
+ [0, i1, {test.A}]]} {
return
}
// -----
-// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B})
-func @f(%arg0: f32 {test.B}) attributes {test.insert_args = [
- [0, f32, {test.A}]]} {
+// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B})
+func @f(%arg0: i2 {test.B}) attributes {test.insert_args = [
+ [0, i1, {test.A}]]} {
return
}
// -----
-// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B})
-func @f(%arg0: f32 {test.A}) attributes {test.insert_args = [
- [1, f32, {test.B}]]} {
+// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B})
+func @f(%arg0: i1 {test.A}) attributes {test.insert_args = [
+ [1, i2, {test.B}]]} {
return
}
// -----
-// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B}, %arg2: f32 {test.C})
-func @f(%arg0: f32 {test.A}, %arg1: f32 {test.C}) attributes {test.insert_args = [
- [1, f32, {test.B}]]} {
+// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B}, %arg2: i3 {test.C})
+func @f(%arg0: i1 {test.A}, %arg1: i3 {test.C}) attributes {test.insert_args = [
+ [1, i2, {test.B}]]} {
return
}
// -----
-// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B}, %arg2: f32 {test.C})
-func @f(%arg0: f32 {test.B}) attributes {test.insert_args = [
- [0, f32, {test.A}],
- [1, f32, {test.C}]]} {
+// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B}, %arg2: i3 {test.C})
+func @f(%arg0: i2 {test.B}) attributes {test.insert_args = [
+ [0, i1, {test.A}],
+ [1, i3, {test.C}]]} {
return
}
// -----
-// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B}, %arg2: f32 {test.C})
-func @f(%arg0: f32 {test.C}) attributes {test.insert_args = [
- [0, f32, {test.A}],
- [0, f32, {test.B}]]} {
+// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B}, %arg2: i3 {test.C})
+func @f(%arg0: i3 {test.C}) attributes {test.insert_args = [
+ [0, i1, {test.A}],
+ [0, i2, {test.B}]]} {
return
}
More information about the Mlir-commits
mailing list