[Mlir-commits] [mlir] [mlir, python] Fix case when `FuncOp.arg_attrs` is not set (PR #117188)
Perry Gibson
llvmlistbot at llvm.org
Tue Nov 26 06:15:36 PST 2024
Wheest wrote:
> I don't necessarily mind returning a list of empty dictionary attributes when the attribute is missing (though it doesn't correspond to the underlying IR structure by mixing up two different cases in the IR), but having a property accessor _mutate the operation_ by forcibly setting an attribute on it is wrong.
I agree, the underlying IR shouldn't be changed by this. I've updated the return so that it gives the empty dict list, but not stored in the IR.
```diff
- self.attributes[ARGUMENT_ATTRIBUTE_NAME] = ArrayAttr.get(
- [DictAttr.get({}) for _ in self.type.inputs]
- )
+ return ArrayAttr.get([DictAttr.get({}) for _ in self.type.inputs])
```
https://github.com/llvm/llvm-project/pull/117188
More information about the Mlir-commits
mailing list