Skip to content

[opt] Specialize guarded operand fan-in - #5536

Open
ericxu233 wants to merge 1 commit into
google:mainfrom
ericxu233:fix/5151-conditional-specialization
Open

ericxu233 wants to merge 1 commit into
google:mainfrom
ericxu233:fix/5151-conditional-specialization

Conversation

@ericxu233

@ericxu233 ericxu233 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5151.

Description

Extend ConditionalSpecializationPass to simplify an operand’s fan-in using facts implied by its siblings or by the select case that consumes it. The pass walks a bounded portion of the fan-in, substitutes proven constants, and rewires one operand edge at a time.

Why implement in the ConditionalSpecializationPass

This pass already determines when a consumer can observe an operand. It uses that information to replace an operand with a constant or bypass a select when the chosen case is known. The new rewrite uses the same analysis when the operand’s result still depends on other inputs. Applying it per use also lets the pass simplify shared logic under a particular guard while preserving its value for other consumers.

Testing

Ran fuzzing for an hour and found no issues.

Note

This PR and description were prepared with LLM assistant.

This branch has not been deployed

No deployments
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.

opt fails to propagate non-absorbing or/and sibling conditions into operand fanin

1 participant