-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Moore] Add constant materialization, fold constant conversions #7478
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it required to implement a fold function for operations that have the ConstantLike
trait that just returns the attribute?
Also, ConstantStringOp already has ConstantLike added, so maybe also support that in the constant materializer?
Otherwise, this looks great! 🎉
Oh good point, I forgot about the string constant op. Will add a fold method there. Apparently it's not technically required, or at least nothing complained so far about the string constant being |
Ugh just realized that the |
Oh, yeah that sounds annoying. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
4576518
to
9dde613
Compare
Implement the `materializeConstant` function for the Moore dialect and mark the `ConstantOp` as a `ConstantLike` operation. This now allows us to write constant folders for various operations. As a first example, add a constant folder for `ConversionOp` that directly applies domain conversions (e.g., `i42` to `l42` or vice versa) to constants.
5343d71
to
d4d6c0f
Compare
Implement the
materializeConstant
function for the Moore dialect and mark theConstantOp
as aConstantLike
operation. This now allows us to write constant folders for various operations. As a first example, add a constant folder forConversionOp
that directly applies domain conversions (e.g.,i42
tol42
or vice versa) to constants.