[Mlir-commits] [mlir] [MLIR][LivenessAnalysis] Treat a public function as an external (PR #160648)
Mehdi Amini
llvmlistbot at llvm.org
Fri Sep 26 12:11:01 PDT 2025
================
@@ -569,6 +569,18 @@ module @return_void_with_unused_argument {
call @fn_return_void_with_unused_argument(%arg0, %unused) : (i32, memref<4xi32>) -> ()
return %unused : memref<4xi32>
}
+ // the function signature is immutable because it is public.
+ func.func public @public_fn_with_unused_argument(%unused: i32) -> () {
+ return
+ }
+ // CHECK-LABEL: func.func @main2
+ // CHECK: %[[UNUSED:.*]] = arith.constant 0 : i32
+ // CHECK: call @public_fn_with_unused_argument(%[[UNUSED]]) : (i32) -> ()
+ func.func @main2(%arg0: i32) -> () {
+ %zero = arith.constant 0 : i32
+ call @public_fn_with_unused_argument(%zero) : (i32) -> ()
----------------
joker-eph wrote:
arg0 is unused here, so we can reduce further:
```suggestion
func.func @main2(%arg0: i32) -> () {
call @public_fn_with_unused_argument(%arg0) : (i32) -> ()
```
https://github.com/llvm/llvm-project/pull/160648
More information about the Mlir-commits
mailing list