[xls][mlir} Fix bug -array-to-bits
related to xls.dynamic_bit_slice
.
#2517
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.
[xls][mlir} Fix bug
-array-to-bits
related toxls.dynamic_bit_slice
.This CL fixes a bug that occurred in the
-array-to-bits
pass during the legalization ofxls.array_slice
, which produced an incorrectstart
value for the resultingxls.dynamic_bit_slice
op. The wrong computation comes from the fact that XLS uses left-to-right offsets forarray
s, including the originalxls.array_slice
op, but right-to-left offsets forbits
, including the createdxls.dynamic_bit_slice
. The previous legalization pattern ignored the direction change during rewriting, so the fix consists of converting the left-to-right offset into a right-to-left offset.The CL also adds missing punctuation in an unrelated file and adds the
ArithDialect
to the dependencies of the-array-to-bits
pass because this and other patterns may create ops from that dialect.