[Mlir-commits] [mlir] [mlir][func] Add eliminate-function-parameter pass (PR #160654)

lonely eagle llvmlistbot at llvm.org
Thu Sep 25 08:36:03 PDT 2025


linuxlonelyeagle wrote:

> remove-dead-values

It appears that remove-dead-values does not work for this.
```
func.func private @single_parameter(%arg: index) {
  return
}

func.func private @mutl_parameter(%arg0 : index, %arg1 : index) -> index {
  return %arg0 : index
}

func.func private @eliminate_parameter(%arg0: index, %arg1: index) -> index {
  func.call @single_parameter(%arg0) : (index) -> ()
  %ret = func.call @mutl_parameter(%arg0, %arg0) : (index, index) -> (index)
  return %ret : index
}
```
run pass 
```
module {
  func.func private @single_parameter(%arg0: index) {
    return
  }
  func.func private @mutl_parameter(%arg0: index, %arg1: index) {
    return
  }
  func.func private @eliminate_parameter(%arg0: index, %arg1: index) {
    call @single_parameter(%arg0) : (index) -> ()
    call @mutl_parameter(%arg0, %arg0) : (index, index) -> ()
    return
  }
}
```

https://github.com/llvm/llvm-project/pull/160654


More information about the Mlir-commits mailing list