Issue 122695
Summary [mlir] remove-dead-values pass removes value that should be live
Labels mlir
Assignees
Reporter azecevicTT
    Here is an example IR:

```mlir
module {
  func.func public @main(%arg0: f32) -> f32 {
    %0 = call @f(%arg0) : (f32) -> f32
    return %0 : f32
 }

  func.func private @f(%arg0: f32) -> f32 {
    %0 = arith.addf %arg0, %arg0 : f32
    return %0 : f32
  }
}
```

Running `mlir-opt -remove-dead-values` on it gives an error:

```
bug.mlir:9:5: error: null operand found
    return %0 : f32
    ^
bug.mlir:9:5: note: see current operation: "func.return"(<<NULL VALUE>>) : (<<NULL TYPE>>) -> ()
```

Changing the order of the `@main` and `@f` produces a valid result.

Git version: https://github.com/llvm/llvm-project/commit/2914ba1c01fdc496082197abf7cd35e2af526634
System: `Ubuntu 22.04`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to