[Mlir-commits] [mlir] Fix block merging (PR #97697)

Giuseppe Rossini llvmlistbot at llvm.org
Thu Jul 4 02:05:18 PDT 2024


giuseros wrote:

Hi @joker-eph , @Mogball ,
I reworked the code and fixed the bug. What was happening was that in a test like the following:
```
  llvm.cond_br %cond, ^bb1, ^bb2
^bb1:
  llvm.call @foo(%0) : (i64) -> ()
  llvm.call @foo(%0) : (i64) -> ()
  llvm.br ^bb3
^bb2:
  llvm.call @foo(%1) : (i64) -> ()
  llvm.call @foo(%2) : (i64) -> ()
  llvm.br ^bb3
^bb3:
  llvm.return
```
We were forming argument lists of different lengths `(%0)` for `bb1` and `(%1,%2)` for `bb2`, and this was returning a malformed IR. Now I do the argument pruning as a successive step and only prune an argument if it is prunable in every successor. I added this (and some more cases) as unit tests. 

I compiled with `-DMLIR_INCLUDE_INTEGRATION_TESTS=ON` and everything passed. Is there any more testing I can enable?

Thanks!


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


More information about the Mlir-commits mailing list