Skip to content

Commit fce529f

Browse files
committed
Fix insertFunctionArguments() block argument order.
Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D113171
1 parent 7d323dc commit fce529f

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

mlir/lib/IR/FunctionSupport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void mlir::function_like_impl::insertFunctionArguments(
164164
// Update the function type and any entry block arguments.
165165
op->setAttr(getTypeAttrName(), TypeAttr::get(newType));
166166
for (unsigned i = 0, e = argIndices.size(); i < e; ++i)
167-
entry.insertArgument(argIndices[i], argTypes[i],
167+
entry.insertArgument(argIndices[i] + i, argTypes[i],
168168
argLocs.empty() ? Optional<Location>{} : argLocs[i]);
169169
}
170170

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
// RUN: mlir-opt %s -test-func-insert-arg -split-input-file | FileCheck %s
22

3-
// CHECK: func @f(%arg0: f32 {test.A})
3+
// CHECK: func @f(%arg0: i1 {test.A})
44
func @f() attributes {test.insert_args = [
5-
[0, f32, {test.A}]]} {
5+
[0, i1, {test.A}]]} {
66
return
77
}
88

99
// -----
1010

11-
// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B})
12-
func @f(%arg0: f32 {test.B}) attributes {test.insert_args = [
13-
[0, f32, {test.A}]]} {
11+
// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B})
12+
func @f(%arg0: i2 {test.B}) attributes {test.insert_args = [
13+
[0, i1, {test.A}]]} {
1414
return
1515
}
1616

1717
// -----
1818

19-
// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B})
20-
func @f(%arg0: f32 {test.A}) attributes {test.insert_args = [
21-
[1, f32, {test.B}]]} {
19+
// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B})
20+
func @f(%arg0: i1 {test.A}) attributes {test.insert_args = [
21+
[1, i2, {test.B}]]} {
2222
return
2323
}
2424

2525
// -----
2626

27-
// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B}, %arg2: f32 {test.C})
28-
func @f(%arg0: f32 {test.A}, %arg1: f32 {test.C}) attributes {test.insert_args = [
29-
[1, f32, {test.B}]]} {
27+
// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B}, %arg2: i3 {test.C})
28+
func @f(%arg0: i1 {test.A}, %arg1: i3 {test.C}) attributes {test.insert_args = [
29+
[1, i2, {test.B}]]} {
3030
return
3131
}
3232

3333
// -----
3434

35-
// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B}, %arg2: f32 {test.C})
36-
func @f(%arg0: f32 {test.B}) attributes {test.insert_args = [
37-
[0, f32, {test.A}],
38-
[1, f32, {test.C}]]} {
35+
// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B}, %arg2: i3 {test.C})
36+
func @f(%arg0: i2 {test.B}) attributes {test.insert_args = [
37+
[0, i1, {test.A}],
38+
[1, i3, {test.C}]]} {
3939
return
4040
}
4141

4242
// -----
4343

44-
// CHECK: func @f(%arg0: f32 {test.A}, %arg1: f32 {test.B}, %arg2: f32 {test.C})
45-
func @f(%arg0: f32 {test.C}) attributes {test.insert_args = [
46-
[0, f32, {test.A}],
47-
[0, f32, {test.B}]]} {
44+
// CHECK: func @f(%arg0: i1 {test.A}, %arg1: i2 {test.B}, %arg2: i3 {test.C})
45+
func @f(%arg0: i3 {test.C}) attributes {test.insert_args = [
46+
[0, i1, {test.A}],
47+
[0, i2, {test.B}]]} {
4848
return
4949
}

0 commit comments

Comments
 (0)