Skip to content

xls/solvers: Handle zero-width start operand in Z3 HandleDynamicBitSlice. - #5456

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1024971545
Nov 19, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1024971545

Conversation

@copybara-service

Copy link
Copy Markdown

xls/solvers: Handle zero-width start operand in Z3 HandleDynamicBitSlice.

z3::IrTranslator::HandleDynamicBitSlice unconditionally called GetBitVec on
the start operand, which CHECK-fails when start has type bits[0] (valid
XLS IR where start is identically 0).

Short-circuit start_width == 0 directly to an extract from bit 0:

  • Extract [width - 1 : 0] directly from value when start has 0 bits
    (the IR verifier guarantees value_width >= width).
  • Add Z3IrTranslatorTest.ZeroWidthStartDynamicSlice covering sub-width and
    full-width slices with a bits[0] start operand.

@copybara-service
copybara-service Bot force-pushed the test_1024971545 branch 2 times, most recently from 108595e to 4ef0775 Compare November 19, 2026 12:15
…ice.

`z3::IrTranslator::HandleDynamicBitSlice` unconditionally called `GetBitVec` on
the `start` operand, which `CHECK`-fails when `start` has type `bits[0]` (valid
XLS IR where `start` is identically 0).

Short-circuit `start_width == 0` directly to an extract from bit 0:

* Extract `[width - 1 : 0]` directly from `value` when `start` has 0 bits
  (the IR verifier guarantees `value_width >= width`).
* Add `Z3IrTranslatorTest.ZeroWidthStartDynamicSlice` covering sub-width and
  full-width slices with a `bits[0]` start operand.

PiperOrigin-RevId: 1025487959
@copybara-service
copybara-service Bot merged commit e6f79c0 into main Nov 19, 2026
7 checks passed
@copybara-service
copybara-service Bot deleted the test_1024971545 branch November 19, 2026 13:04

This branch was previously deployed

1 inactive deployment
github-pages — e6f79c08 Deployed Nov 19, 2026 by copybara-service[bot] via deploy #14637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant