[Mlir-commits] [mlir] [MLIR][LLVM] Block address support (PR #134335)

Tobias Gysi llvmlistbot at llvm.org
Sat Apr 5 04:49:26 PDT 2025


gysit wrote:

> I would like to also write a test for even more simple block merging (something like https://godbolt.org/z/c5o78o6Y9), but canonicalize can't seem to do the job, how do call mlir-opt to transform this:

It seems you need to lift to control flow dialect:
```
llvm.func @callee()

func.func @fn() {
  cf.br ^bb1
^bb1:
  llvm.call @callee() : () -> ()
  cf.br ^bb2
^bb2:
  llvm.call @callee() : () -> ()
  func.return
}
```
I had in mind that region simplify does merge consecutive blocks if there is only one control flow edge between them. However, this actually requires the operation to implement a canonicalization pattern. In that sense your PR is fine then since whoever would like to implement a canonicalization for llvm.br would have to check if there is a tag operation. 



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


More information about the Mlir-commits mailing list