Skip to content
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

[CombToArith] Fix lowering of concat with single operand #6505

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

fabianschuiki
Copy link
Contributor

A comb.concat operation with only a single operand would cause an arith.extui to be emitted with the same operand and result type. This trips the verifier of extui. Add a special case to that conversion to simply remove the comb.concat if it only has one operand.

The canonicalizer would usually delete these degenerate concats, which is why we haven't seen this issue earlier.

Also slightly tweak the lowering to produce a shift and or op for the least significant operand of the concat, which is already in the right spot.

A `comb.concat` operation with only a single operand would cause an
`arith.extui` to be emitted with the same operand and result type. This
trips the verifier of `extui`. Add a special case to that conversion to
simply remove the `comb.concat` if it only has one operand.

The canonicalizer would usually delete these degenerate concats, which
is why we haven't seen this issue earlier.

Also slightly tweak the lowering to produce a shift and or op for the
least significant operand of the concat, which is already in the right
spot.
@fabianschuiki fabianschuiki added the Comb Involving the `comb` dialect label Dec 8, 2023
Copy link
Member

@maerhart maerhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🎉

@fabianschuiki fabianschuiki merged commit 0a6895b into main Dec 8, 2023
4 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/fix-concat-to-arith-lowering branch December 8, 2023 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Comb Involving the `comb` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants