Commit d47b07e
Implement comprehensive IR optimizations
Add the following optimization passes to the IR optimizer:
- Constant folding: evaluates compile-time expressions (arithmetic,
string concatenation, boolean operations, comparisons)
- Case-of-known-constructor: simplifies match expressions when the
scrutinee is a known literal or constructor application
- Beta reduction: inlines lambda applications ((λx. body) arg → body[x := arg])
for both local and global function definitions
- Eta reduction: simplifies wrapper functions (λx. f x → f)
- Extended value tracking: tracks constructor applications and lambdas
through the environment for cross-expression optimization
- Transitive inline resolution: resolves chains of variable references
- Iterative fixpoint optimization: runs optimization passes until no
more improvements are found
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 482646d commit d47b07e
1 file changed
+584
-24
lines changed
0 commit comments