This paper presents a global approach to representation analysis based on program-wide data and control flow information.
Boxing and unboxing coercions can be placed around any variable occurrence, not only where values are produced and consumed.
The analysis first constructs a graph representing all legal coercion placements, then selects one of them. Assigning unboxed
representations to as many variables as possible does not necessarily minimize execution time (or the number of executed coercions);
we present and measure several heuristics.
When combined with function cloning, the analysis is powerful enough to eliminate almost all coercions from several nonstrict
programs, including a simple polymorphic type checker.