Repository navigation
perf(sv): reuse constants when expression contexts match - #1669
Merged
mergify[bot] merged 1 commit intoOct 21, 2026
Conversation
Constant evaluation first computed each operand in its own context and then walked the same subtree again even when width and signedness were unchanged. Nested casts repeated this work, causing pathological growth in deep trees. Reuse the computed value for matching contexts and for casts that do not widen their operand. Reevaluate operands when width or signedness changes, preserving context-dependent carries, division and four-state values under IEEE 1800-2023 11.8.2. Taxi BASE-R compilation with the debug host and generated O1 code decreases from 174 seconds to 55 seconds. The release host improves from 30.9 seconds to 8.4 seconds (user CPU 25.95s to 8.01s); generated code remains at O1. The release baseline attributes about 60% of sampled CPU time to context_binary_operands. The unchanged selected upstream cocotb cases both pass after the optimization (2 executed, 238 skipped). The full BASE-R matrix still needs the upstream 1fs precision override, which the current CLI harness does not support; no all-matrix pass is claimed. Validation: deep 48-layer constant casts including X/Z, widening carries and signedness-changing division; 36 focused literal tests; full analyzer tests (762 passed, 3 ignored); full SystemVerilog suite across five backends (3242 passed, 90 ignored); formatting and affected-crate Clippy. Change-Id: I2bdbf133a10a898df17646cf566fa5a24496ff15
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Oct 21, 2026
Contributor
Author
|
This pull request is part of a Mergify stack:
|
Contributor
Merge Queue Status
This pull request spent 1 hour 38 minutes 12 seconds in the queue, including 44 minutes 17 seconds running CI. Required conditions to merge
|
This was referenced Oct 21, 2026
Base automatically changed from
stack/tignear/fix/taxi-compatibility/avoid-metadata-cloning-value-access--64bd0bd3
to
master
October 21, 2026 02:38
mergify
Bot
deleted the
stack/tignear/fix/taxi-compatibility/reuse-constants-expression-contexts-match--2bdbf133
branch
October 21, 2026 02:40
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.
Constant evaluation first computed each operand in its own context and then
walked the same subtree again even when width and signedness were unchanged.
Nested casts repeated this work, causing pathological growth in deep trees.
Reuse the computed value for matching contexts and for casts that do not
widen their operand. Reevaluate operands when width or signedness changes,
preserving context-dependent carries, division and four-state values under
IEEE 1800-2023 11.8.2.
Taxi BASE-R compilation with the debug host and generated O1 code decreases
from 174 seconds to 55 seconds. The release host improves from 30.9 seconds
to 8.4 seconds (user CPU 25.95s to 8.01s); generated code remains at O1.
The release baseline attributes about 60% of sampled CPU time to
context_binary_operands. The unchanged selected upstream
cocotb cases both pass after the optimization (2 executed, 238 skipped).
The full BASE-R matrix still needs the upstream 1fs precision override,
which the current CLI harness does not support; no all-matrix pass is claimed.
Validation: deep 48-layer constant casts including X/Z, widening carries and
signedness-changing division; 36 focused literal tests; full analyzer tests
(762 passed, 3 ignored); full SystemVerilog suite across five backends
(3242 passed, 90 ignored); formatting and affected-crate Clippy.
Depends-On: #1668