Constant Propagation and Merging Values
Use a lattice of facts to represent a known constant, absent information from an unreachable path, and genuine disagreement.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Equal incoming constants can survive a merge
Use an order with an initial bottom value, a distinct state for each constant, and a top value meaning no single constant is known. Joining the same constant yields itself. Joining \(3\) and \(4\) yields top. In a program where both branches assign \(x:=3\), the merge keeps \(x=3\), and an addition of two at that point can fold to five according to the machine’s arithmetic.
Distinguish infeasibility from lack of a known value
An unreachable edge should contribute no conflicting constant. This is different from a reachable execution with an unknown value. Ordinary propagation over all graph edges can lose information when it treats a conditionally impossible path like a possible one. Sparse conditional constant propagation tracks executable edges alongside values. Dataflow orders explain why the join and bottom elements must match the analysis promise.[1][2]