Skip to content

Commit

Permalink
Fix attr aliasing on region args (#389)
Browse files Browse the repository at this point in the history
* Fix for aliasing the region args

* Add test case

* Add empty line
  • Loading branch information
josel-amd authored Oct 18, 2024
1 parent 3cd352b commit 2015abf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions mlir/lib/IR/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ class DummyAliasOperationPrinter : private OpAsmPrinter {
void printRegionArgument(BlockArgument arg, ArrayRef<NamedAttribute> argAttrs,
bool omitType) override {
printType(arg.getType());
printOptionalAttrDict(argAttrs);
// Visit the argument location.
if (printerFlags.shouldPrintDebugInfo())
// TODO: Allow deferring argument locations.
Expand Down
11 changes: 11 additions & 0 deletions mlir/test/IR/test-region-attr-aliasing.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: mlir-opt %s | FileCheck %s

#map = affine_map<(d0) -> (d0)>
// CHECK: {builtin.test = #map}
func.func @test_attr_alias_on_region_attr(%arg0: memref<2xf32> {builtin.test = #map}) {
%c0 = arith.constant 0 : index
%c1 = arith.constant 0 : index
%2 = memref.load %arg0[%c0] : memref<2xf32>
memref.store %2, %arg0[%c1] : memref<2xf32>
return
}

0 comments on commit 2015abf

Please sign in to comment.