Repository navigation
[dslx][ir] Reject equality of incomparable types - #5468
Merged
copybara-service[bot] merged 1 commit intoNov 24, 2026
Merged
copybara-service[bot] merged 1 commit into
copybara-service[bot] merged 1 commit into
Conversation
cdleary
force-pushed
the
cdleary/2026-11-18-reject-incomparable-equality
branch
from
November 19, 2026 04:15
3b71ae5 to
96637a4
Compare
cdleary
marked this pull request as ready for review
November 19, 2026 04:15
ericastor
approved these changes
Nov 23, 2026
Contributor
There was a problem hiding this comment.
This is a good fix - thank you.
cdleary
added a commit
to xlsynth/xlsynth
that referenced
this pull request
Nov 23, 2026
cdleary
added a commit
to xlsynth/xlsynth
that referenced
this pull request
Nov 24, 2026
cdleary
added a commit
to xlsynth/xlsynth
that referenced
this pull request
Nov 24, 2026
cdleary
added a commit
to xlsynth/xlsynth
that referenced
this pull request
Nov 24, 2026
This was referenced Nov 24, 2026
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.
Summary
The IR verifier checked only the outer operand type, so it accepted this comparison between tuples containing tokens.
The DSLX interpreter compares token identity and returns
x. IR conversion emits payload-free tokens and loses the distinction betweenAandB. The IR interpreter therefore returnstrueforx = false, and the optimizer silently folds the function to a constanttrue. The JIT rejects the unoptimized comparison.Require comparable operand types for DSLX
==,!=,assert_eq, andassert_ne. Arrays, tuples, and ordinary structs support equality recursively when their element or member types do. The IR verifier now rejectseqandneoperands that contain a token at any depth. Regression tests cover the reproducer, comparable aggregates, and the IR verifier.Testing
All 2,226 selected targets passed in the optimized
//xls/...OSS sweep. The sweep skips tests that build OpenROAD, Yosys, or Clang.