Natural loops have a nice property. We want to find the stage-level nesting relationship for an entire program and to label each stage. The Procedure-CSL of a procedure is the MAX of the CSLs of all calls to that procedure. The CSL is a static estimate of the execution frequency of a basic block and is therefore a numeric value for the amount of code reuse. The interesting case to handle is call graphs with cycles.
Cycles indicate recursive procedures.
Classical data-flow solvers iterate when they encounter a cycle in their graph. In this case the cycle represents additional code reuse, rather than indicating that the solution is complex to compute. The existence of the cycle needs to be integrated into the CSL calculations. The current invocation of the solver is now done. Once each block of code is labeled with its CSL, we can determine if there are any variables referenced within a stage that are not modified within that stage.