[FIRRTL][OM] Add string.concat canonicalization#9997
Merged
Conversation
Add canonicalization patterns for `firrtl.string.concat` and `om.string.concat` that: 1. flatten nested `string.concat` operations, 2. merge consecutive constant strings, 3. drop empty strings, 4. and replace single-operand concat with the operand itself. AI-assisted-by: Augment (Claude Sonnet 4.5) Signed-off-by: Schuyler Eldridge <[email protected]>
uenoku
reviewed
Mar 21, 2026
uenoku
reviewed
Mar 21, 2026
lib/Dialect/FIRRTL/FIRRTLFolds.cpp
Outdated
|
|
||
| /// Remove empty string operands from concat. | ||
| /// string.concat(a, "", b) -> string.concat(a, b) | ||
| class RemoveEmptyStrings : public mlir::RewritePattern { |
Member
There was a problem hiding this comment.
Please use OpRewritePattern, or consider unifying these canonicalizations between OM and FIRRTL.
uenoku
reviewed
Mar 21, 2026
uenoku
reviewed
Mar 21, 2026
Member
|
I think 3 can be performed at the same time as 2. 4 should be implemented as a folder. |
Signed-off-by: Schuyler Eldridge <[email protected]>
Signed-off-by: Schuyler Eldridge <[email protected]>
Signed-off-by: Schuyler Eldridge <[email protected]>
Contributor
Signed-off-by: Schuyler Eldridge <[email protected]>
Signed-off-by: Schuyler Eldridge <[email protected]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add canonicalization patterns for
firrtl.string.concatandom.string.concatthat:string.concatoperations,AI-assisted-by: Augment (Claude Sonnet 4.5)