Commit 24c4c1a
committed
Fix five categories of optimizer reconstruction bugs
1. Type inference: When egglog rewrites change operation domain (e.g.,
Select→IAdd), the reconstruction now infers correct SPIR-V types
instead of blindly using the original instruction's type. Adds
TypeClass classification and infer_result_type for both top-level
instructions and nested materialize_term sub-expressions.
2. Binding order: Egglog let-bindings are now emitted in topological
dependency order instead of sorted by numeric ID. This prevents
"unbound symbol" crashes when block processing order puts a higher
ID into id_to_term before a lower ID that references it.
3. Duplicate IDs: Synthesized constants and folded constants are now
deduplicated before adding to types_global_values, preventing
"id defined more than once" errors.
4. Dominance: Synthesized intermediate instructions are now placed in
the same block as the root instruction they serve, instead of always
in block 0 of function 0. This prevents dominance violations when
operands are defined in different blocks.
5. Loop preservation: Selection constructs inside loop bodies are now
skipped for RVSDG EffGamma transforms, preventing block terminator
rewrites from breaking continue-block reachability.1 parent d78b42b commit 24c4c1a
1 file changed
Lines changed: 681 additions & 64 deletions
0 commit comments