[Mlir-commits] [mlir] [MLIR] Fuse locations of hoisted / merged constants (PR #74670)

Jeff Niu llvmlistbot at llvm.org
Wed Dec 6 23:33:58 PST 2023


Mogball wrote:

Concretely, the problem with hoisting constants to the top of basic blocks is that if those constant ops don't become "trivial" (e.g. they don't lower directly to LLVM constants and have some codegen), debuggers will pick them up when stepping into a function. E.g.

```mlir
func @my_function() {
  "some.op"() : () -> ()
  %c0 = some.complex.constant = [1, 2, 3]
  return
}
```

If the constant gets hoisted and lowers to non-trivial code:

```mlir
llvm.func @my_function() {
  %0 = llvm.mlir.undef : ...
  // bunch of code constructing the "constant"
  "some.op"() :() -> ()
}
```

The debugger will jump around because the source locations are messed up.

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


More information about the Mlir-commits mailing list