[mlir][python] Allow specifying block arg locations
authorRahul Kayaith <rkayaith@gmail.com>
Mon, 8 May 2023 03:56:04 +0000 (23:56 -0400)
committerRahul Kayaith <rkayaith@gmail.com>
Tue, 9 May 2023 16:40:17 +0000 (12:40 -0400)
commit4d0d295b618edfc937d5bf247f0853df5c70cb96
tree5b9e278cfc09d97a1ecf829f7fa2d16b073c949e
parentb9031d327929c160293f38b0afbf7facec0f591c
[mlir][python] Allow specifying block arg locations

Currently blocks are always created with UnknownLoc's for their arguments. This
adds an `arg_locs` argument to all block creation APIs, which takes an optional
sequence of locations to use, one per block argument. If no locations are
supplied, the current Location context is used.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D150084
mlir/lib/Bindings/Python/IRCore.cpp
mlir/python/mlir/dialects/_func_ops_ext.py
mlir/test/python/ir/blocks.py