Value Numbering
2 days ago
- #Value Numbering
- #Compiler Optimization
- #Static Single Assignment
- Value numbering identifies instructions that produce the same value at compile-time, optimizing by reusing results.
- It extends SSA by using hash-consing to detect textually identical instructions, focusing on pure operations.
- Local Value Numbering (LVN) works on linear sequences, iterating top-down to replace duplicates via a hash map.
- Global Value Numbering (GVN) handles control flow by using dominator relationships to share values across blocks.
- GVN implementations, like Maxine VM, clone value maps from dominator blocks to enable cross-block optimization.
- Impure operations (e.g., loads/stores) require additional tracking, such as memory state or load-store forwarding.
- Alternative approaches include unified hash tables for better expression availability and value partitioning.
- Value numbering is effective even in dynamic JIT contexts, cleaning up repeated instructions after optimizations.