[MLIR] `remove-dead-values` misses a dead block argument
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
In the following example, `--remove-dead-values` should remove the block argument `%0` on line 4 because it is never used. However, the pass fails to remove it, resulting in a missed optimization opportunity.
### Input Program
**input.mlir**
```mlir
module {
func.func @func_t8(%arg0: i32) -> i32 {
cf.br ^bb1(%arg0 : i32)
^bb1(%0: i32): // pred: ^bb0
return %arg0 : i32
}
}
```
### Command
```bash
mlir-opt --remove-dead-values input.mlir
```
Version: ef88536bbf62469eb2396d719d237b3191cf4843
Contributor guide
Research direction
Start by running the `mlir-opt --remove-dead-values input.mlir` command from the issue with the provided `input.mlir` reproducer. Trace the `remove-dead-values` pass to find why the unused block argument is retained, then verify that the resulting IR removes `%0` from `^bb1` and its incoming argument.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100