Adding new op just for the custom attribute support


The complex dialect now has an attribute Complex_NumberAttr to make the semantics of the complex number easy to understand and tidy. I want to support this custom attribute to create the complex number in the dialect so that developers can easily manipulate the number in the various passes.

But I found complex.constant op is already tightly coupled with various dialects and supporting the custom attribute brings several breaking changes in the interface and error treatment since one op cannot support two input types now.

So I’m thinking now two possible options

  1. Changing the complex.constant op to get Complex_NumberAttr and modifying all other dialect passes using this op.
  2. Provide another op (e.g. complex.constant_by_attr) so we do not impact the existing usage.

Which option is making sense to support new custom op in the existing dialect? I just want to hear your idea or thoughts on this change.

And I also want to know If there is any dialect that has op supporting two types of input (SSA value and attribute) even outside of the LLVM repository. We may be able to refer to.


Reference: Incomplete definition for the custom attribute