Skip to content

[Synth] Add canonicalization for synth.choice#10019

Open
joaovam wants to merge 4 commits intollvm:mainfrom
joaovam:canonicalization-for-choice-op
Open

[Synth] Add canonicalization for synth.choice#10019
joaovam wants to merge 4 commits intollvm:mainfrom
joaovam:canonicalization-for-choice-op

Conversation

@joaovam
Copy link
Contributor

@joaovam joaovam commented Mar 23, 2026

Resolves #9932

This PR implements the transitive merge canonicalization for the synth.choice operation.

How it works:
It uses a worklist algorithm to compute the transitive closure of connected synth.choice operations. By traversing both the definitions and the users, it flattens nested or shared choices into a single, unified operation while automatically deduplicating redundant operands.

Example

// Before:
%0 = synth.choice %x, %y, %z
%1 = synth.choice %0, %u
%2 = synth.choice %z, %v

// After:
%merged_choice = synth.choice %x, %y, %z, %u, %v

@uenoku uenoku self-requested a review March 24, 2026 01:25
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.

[Synth] Add canonicalization for choice

1 participant