[Mlir-commits] [mlir] [mlir][py][c] Enable setting block arg locations. (PR #169033)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Nov 21 05:01:00 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD mlir/test/python/ir/blocks.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- blocks.py 2025-11-21 10:51:07.000000 +0000
+++ blocks.py 2025-11-21 13:00:30.099072 +0000
@@ -178,31 +178,31 @@
# CHECK-LABEL: TEST: testBlockEraseArgs
@run
def testBlockEraseArgs():
- with Context() as ctx, Location.unknown(ctx) as loc:
- ctx.allow_unregistered_dialects = True
- f32 = F32Type.get()
- op = Operation.create("test", regions=1, loc=Location.unknown())
- blocks = op.regions[0].blocks
- blocks.append(f32)
- # CHECK: ^bb0(%{{.+}}: f32 loc(unknown)):
- op.print(enable_debug_info=True)
- blocks[0].erase_argument(0)
- # CHECK: ^bb0:
- op.print(enable_debug_info=True)
+ with Context() as ctx, Location.unknown(ctx) as loc:
+ ctx.allow_unregistered_dialects = True
+ f32 = F32Type.get()
+ op = Operation.create("test", regions=1, loc=Location.unknown())
+ blocks = op.regions[0].blocks
+ blocks.append(f32)
+ # CHECK: ^bb0(%{{.+}}: f32 loc(unknown)):
+ op.print(enable_debug_info=True)
+ blocks[0].erase_argument(0)
+ # CHECK: ^bb0:
+ op.print(enable_debug_info=True)
# CHECK-LABEL: TEST: testBlockArgSetLocation
# CHECK: ^bb0(%{{.+}}: f32 loc("new_loc")):
@run
def testBlockArgSetLocation():
- with Context() as ctx, Location.unknown(ctx) as loc:
- ctx.allow_unregistered_dialects = True
- f32 = F32Type.get()
- op = Operation.create("test", regions=1, loc=Location.unknown())
- blocks = op.regions[0].blocks
- blocks.append(f32)
- arg = blocks[0].arguments[0]
- arg.set_location(Location.name("new_loc"))
- op.print(enable_debug_info=True)
+ with Context() as ctx, Location.unknown(ctx) as loc:
+ ctx.allow_unregistered_dialects = True
+ f32 = F32Type.get()
+ op = Operation.create("test", regions=1, loc=Location.unknown())
+ blocks = op.regions[0].blocks
+ blocks.append(f32)
+ arg = blocks[0].arguments[0]
+ arg.set_location(Location.name("new_loc"))
+ op.print(enable_debug_info=True)
``````````
</details>
https://github.com/llvm/llvm-project/pull/169033
More information about the Mlir-commits
mailing list