In computer science, sparse conditional constant propagation (SCCP) is an optimization frequently applied in compilers after conversion to static single assignment form (SSA). It simultaneously removes some kinds of dead code and propagates constants throughout a program. Moreover, it can find more constant values, and thus more opportunities for improvement, than separately applying dead code elimination and constant propagation in any order or any number of repetitions.[1][2] The algorithm operates by performing abstract interpretation of the code in SSA form. During abstract interpretation, it typically uses a flat lattice of constants for values and a global environment mapping SSA variables to values in this lattice. The crux of the algorithm comes in how it handles the interpretation of branch instructions. When encountered, the condition for a branch is evaluated as best possible given the precision of the abstract values bound to variables in the condition. It may be the case that the values are perfectly precise (neither top nor bottom) and hence, abstract execution can decide in which direction to branch. If the values are not constant, or a variable in the condition is undefined, then both branch directions must be taken to remain conservative. Upon completion of the abstract interpretation, instructions which were never reached are marked as dead code. SSA variables found to have constant values may then be inlined at (propagated to) their point of use. ## Notes 1. ↑ Wegman, Mark N. and Zadeck, F. Kenneth. "Constant Propagation with Conditional Branches." ACM Transactions on Programming Languages and Systems, 13(2), April 1991, pages 181-210. 2. ↑ Click, Clifford and Cooper, Keith. "Combining Analyses, Combining Optimizations", ACM Transactions on Programming Languages and Systems, 17(2), March 1995, pages 181-196 ## References * Cooper, Keith D. and Torczon, Linda. Engineering a Compiler. Morgan Kaufmann. 2005. * v * t * e Compiler optimizations Basic block| * Peephole optimization Loop optimization| * Induction variable * Strength reduction * Loop fusion * Loop inversion * Loop interchange * Loop-invariant code motion * Loop nest optimization * Loop unrolling * Loop splitting * Loop unswitching * Software pipelining * Automatic parallelization Data-flow analysis| * Common subexpression elimination * Constant folding * Induction variable recognition and elimination * Dead store elimination * Use-define chain * Live variable analysis * Available expression SSA-based| * Global value numbering * Sparse conditional constant propagation Code generation| * Register allocation * Instruction selection * Instruction scheduling * Rematerialization Functional| * Tail call elimination * Deforestation Global| * Interprocedural optimization Other| * Bounds-checking elimination * Compile-time function execution * Dead code elimination * Inline expansion * Jump threading Static analysis| * Alias analysis * Pointer analysis * Shape analysis * Escape analysis * Array access analysis * Dependence analysis * Control flow analysis * Data-flow analysis 0.00 (0 votes) Original source: https://en.wikipedia.org/wiki/Sparse conditional constant propagation. Read more | Retrieved from "https://handwiki.org/wiki/index.php?title=Sparse_conditional_constant_propagation&oldid=115926" *[v]: View this template *[t]: Discuss this template *[e]: Edit this template