Algorithm Search⌘K

Compilers and program analysis

The representations, analyses and transformations that turn programs into fast code and prove facts about them.

Problems

  • Available expressions

    For each program point, find the expressions computed on every path to it with no later change to their operands.

    intro
  • Live variable analysis

    For each program point, find the variables whose current value may be read on some path before being overwritten.

    intro
  • Reaching definitions

    For each program point, find the definitions of variables that can reach it along some path without being overwritten.

    intro
  • Type checking problem

    Given a typing context, a term and a type, decide whether the term has that type under the rules of a type system.

    intro
  • Alias analysis

    Decide whether two memory references in a program may, or must, refer to the same location.

    core
  • Call graph construction

    Find a sound superset of the targets of each call site of a program with virtual or indirect calls, from type or pointer facts.

    core
  • Constant propagation

    For each program point, find the variables that hold the same known value on every path, using a flat lattice that is monotone but not distributive.

    core
  • Dependence testing

    Decide whether two array references in a loop nest can touch the same element, an integer programming problem over the iteration space.

    core
  • Global value numbering

    Partition the values of a procedure into classes that surely hold equal values, so that a computation whose class is already computed can be removed.

    core
  • Induction variable analysis

    Find the variables of a loop that change by a fixed amount each iteration, or are affine in such variables.

    core
  • Instruction scheduling

    Order the instructions of a block or region so that dependences and machine resources are respected and the run time is least.

    core
  • Instruction selection

    Cover the IR of a program with patterns of target machine instructions so that the total cost of the chosen instructions is least.

    core
  • Loop invariant synthesis

    Find an inductive loop invariant strong enough to prove a program's specification. Undecidable in general, solved for restricted invariant shapes.

    core
  • Out-of-SSA translation

    Replace the phi-functions of an SSA program by copies on incoming edges so that the program runs on a machine without phi-functions.

    core
  • Partial redundancy elimination

    Insert and remove computations so that no expression is computed twice on any path, which subsumes CSE and loop-invariant code motion.

    core
  • Points-to analysis

    For each pointer variable, find a set of abstract memory locations, such as allocation sites, that it may point to.

    core
  • Program slicing

    Given a program point and a set of variables, find the statements that may affect their values there.

    O(n + e) dependence-slicecore
  • Program synthesis

    Given a specification, such as a formula, examples or a type, find a program in a given language that meets it.

    core
  • Programming by example

    Find a program in a domain-specific language that is consistent with a few given input-output examples and generalizes well.

    core
  • Register allocation

    Assign the values of a program to a fixed number of machine registers, storing the rest in memory at least cost.

    core
  • SSA construction

    Given a program in a non-SSA IR, insert phi-functions and rename variables so that each has one definition and the meaning is kept.

    core
  • Type inference problem

    Given a term without type annotations, find types for its variables and the term that make it well typed, or report that none exist; ideally return a principal type.

    core
  • Very busy expressions

    For each program point, find the expressions that every path from it computes before any of their operands change.

    core
  • Affine scheduling

    Find affine functions that map each statement instance to a time point and respect every dependence, to expose parallelism.

    advanced
  • Mod-ref analysis

    For each call or procedure, find the memory locations it may modify and the ones it may read.

    advanced
  • Reactive synthesis

    Given a temporal logic specification over inputs and outputs, build a finite-state system whose outputs meet it for all input sequences.

    advanced
  • Register coalescing

    Merge the nodes of copy-related values in the interference graph to remove copies, while keeping the graph colorable; NP-complete in general.

    advanced
  • Shape analysis

    Infer the shape of heap data structures a program builds, such as acyclic lists or trees, to prove memory safety and data invariants.

    advanced
  • Automated program repair

    Given a program and tests some of which fail, find a small change to the program that makes all tests pass.

    research

Algorithms

  • Copy propagation

    Replaces uses of x after a copy x = y by y while neither changes, so that the copy can be removed as dead code.

    O(R b n c + c b n v) worst1 languagesintro
  • Local value numbering

    Gives each value in a basic block a number by hashing operator and operand numbers, so equal expressions get the same number.

    Θ(n) expected1 languagesintro
  • Maximal munch instruction selection

    Tiles an expression tree top-down by always choosing the largest pattern that matches at the root, then tiling the subtrees.

    O(n P m) worst1 languagesintro
  • 0-CFA

    Find the functions that each expression of a higher-order program may evaluate to, with one abstract binding per variable, in cubic time.

    O(n^3) worst1 languagescore
  • Aggressive dead code elimination

    Marks instructions with side effects as live, then marks what they depend on through data and control dependence, and deletes the rest.

    O(b^2 n + n^2) worst1 languagescore
  • Aho-Johnson dynamic programming code generation

    Computes, bottom-up, the cheapest cost of each subtree for every number of free registers and for memory, then emits code that stores whole subtrees only where that is cheaper.

    Θ(n r) worst1 languagescore
  • Algorithm W

    Infers the principal type of an ML term bottom-up by unification, generalizing free type variables at each let binding.

    2^(2^O(n)) worst1 languagescore
  • Allen-Kennedy vectorization algorithm

    Distributes a loop nest by the strongly connected components of its dependence graph, level by level, and turns each statement that is on no cycle into a vector statement.

    O(n (r + e)) worst1 languagescore
  • Andersen's analysis

    Flow-insensitive points-to analysis that turns each assignment into a subset constraint and solves the constraint graph in cubic time.

    O(n^3 + m) worst1 languagescore
  • Banerjee test

    Reports independence when the constant of a subscript equation lies outside the real bounds of the equation over the loop bounds.

    O(m k) worst1 languagescore
  • Bottom-up enumerative synthesis

    Enumerates programs of growing size from smaller ones and keeps one program per distinct output vector on the examples.

    O(k b^2) binary rules only1 languagescore
  • CPS conversion

    Translates a direct-style program into continuation-passing style, in one pass without administrative redexes by the Danvy-Filinski method.

    O(n) worst1 languagescore
  • Chaitin register allocation

    Simplifies the interference graph by removing nodes of degree less than k, spills when none is left, and colors in reverse order.

    O(r (l + s n + n^2)) worst1 languagescore
  • Class hierarchy analysis

    Build a call graph from declared types. A virtual call y.m() may reach the method m of every class at or below the declared class of y.

    O(n + S K + K M) worst1 languagescore
  • Closure conversion

    Turns each function with free variables into closed code plus an environment record, so that functions can be compiled as plain code.

    O(n^2) worst1 languagescore
  • Concolic testing

    Runs the program on concrete input while recording the symbolic path condition, then negates a branch and solves for input to a new path.

    O(R (T + m C)) worst1 languagescore
  • Cooper-Harvey-Kennedy dominance algorithm

    Computes immediate dominators by iterating over the nodes in reverse postorder and intersecting paths in the partial dominator tree.

    O((d + 2) n (n + m)) worst1 languagescore
  • Coverage-guided greybox fuzzing

    Mutates inputs from a queue and keeps those that reach new code coverage, measured by lightweight instrumentation.

    O(N T + V (Q E + E log E)) worst1 languagescore
  • Cytron SSA construction

    Builds minimal SSA form by placing phi-functions at the iterated dominance frontiers of each variable's definitions and renaming over the dominator tree.

    O(I + V (n + m + D)) worst · average1 languagescore
  • Delta debugging

    Shrinks a failing input to a 1-minimal failing one by testing subsets and complements of finer and finer partitions.

    O(N^2 (t + N)) worst1 languagescore
  • Dominance frontier computation

    Computes all dominance frontiers in time linear in their total size by a bottom-up walk of the dominator tree.

    Θ(n + m + D) worst · average · best1 languagescore
  • GCD test

    Reports independence when the gcd of the coefficients of a linear subscript equation does not divide its constant term.

    O(m k log C) worst1 languagescore
  • Iterated register coalescing

    Interleaves simplification with conservative coalescing of move-related nodes and freezes moves when stuck, removing many copies safely.

    O(r (l + s n + n^2 (c + 1))) worst1 languagescore
  • Lambda lifting

    Moves local functions to the top level and passes their free variables as extra parameters at each call.

    O(n^3) worst1 languagescore
  • Lazy code motion

    Solves PRE with unidirectional bit-vector analyses, placing each computation as late as possible to keep register pressure low.

    O(n^2 m) worst1 languagescore
  • Linear scan register allocation

    Sorts live intervals by start and assigns registers in one pass, spilling the interval that ends last when registers run out.

    O(l + s n + n log n) worst1 languagescore
  • Local register allocation

    Allocates registers in one basic block in order, and when none is free spills the value whose next use is farthest away.

    O(n k) worst1 languagescore
  • Optimistic coloring

    Pushes a spill candidate on the stack instead of spilling it at once and spills only if no color is free when it is popped.

    O(r (l + s n + n^2)) worst1 languagescore
  • Rapid type analysis

    Build a call graph like class hierarchy analysis, but let a virtual call reach only the classes that some reachable method creates with new.

    O(n + S K + K M) worst1 languagescore
  • Sethi-Ullman algorithm

    Labels each node of an expression tree with the fewest registers that evaluate it, then emits code that evaluates the child with the larger label first and stores only when registers run out.

    Θ(n) worst1 languagescore
  • Slicing by dependence graph reachability

    Computes a backward slice as the set of nodes that reach the criterion in the program dependence graph, in linear time in its size.

    O(n + e) worst1 languagescore
  • Sparse conditional constant propagation

    Propagates constants over SSA edges and executable flow edges together, so it ignores branches that constants prove dead.

    O(n + m + s d) worst · average1 languagescore
  • Steensgaard's analysis

    Flow-insensitive points-to analysis that unifies the targets of both sides of each assignment, with union-find, in almost linear time.

    O((n + m) α(n + m)) worst1 languagescore
  • T1-T2 reduction

    Tests reducibility by removing self-loops and merging nodes with a single predecessor; the graph is reducible if one node remains.

    O(n^2 + m) worst1 languagescore
  • Verification condition generation

    Turns an annotated program into logical formulas, by weakest preconditions or symbolic paths, whose validity implies its correctness.

    O(2^n) worst1 languagescore
  • Weiser's slicing algorithm

    Computes a backward slice by iterating relevant-variable sets over the flow graph and adding the branches that control included statements.

    O((c + 1) ((n + m) v^2 + c n)) worst1 languagescore
  • Worklist dataflow algorithm

    Solves dataflow equations by keeping a worklist of nodes whose input changed and applying their transfer functions until nothing changes.

    O((n + m)(h + 1)) worst · average1 languagescore
  • Algorithm J

    An imperative form of Hindley-Milner inference that keeps one global substitution, updated in place by union-find unification.

    2^O(n) worst1 languagesadvanced
  • Alpern-Wegman-Zadeck value numbering

    Finds congruent SSA values by refining a partition of the value graph until operands of congruent values are congruent, as in DFA minimization.

    O((n + e) log n) worst1 languagesadvanced
  • Array dataflow analysis

    Finds for each read of an array element the exact iteration that last wrote it, by parametric integer programming.

    O(s d (P + L)) worst1 languagesadvanced
  • Ball-Larus path profiling

    Numbers the acyclic paths of a procedure so that adding values on some edges yields a unique path number, counting paths cheaply.

    O(V + E log E) worst1 languagesadvanced
  • Binding-time analysis

    Marks each expression static or dynamic by whether it depends only on known input, which guides offline partial evaluation.

    O(N T) worst1 languagesadvanced
  • Bottom-up rewrite system

    Precomputes the dynamic programming of optimal tree tiling into tables, so a code generator labels each node by table lookup.

    Θ(n) worst1 languagesadvanced
  • Braun SSA construction algorithm

    Builds SSA form directly from an AST or CFG by local value numbering and on-demand lookup in predecessors, with no dominance frontiers.

    O(I + (B + E) V + B^2 V^2) worst · average1 languagesadvanced
  • Dynamic slicing

    Finds the statements that affected a value in one execution, from a trace of the dependences that actually occurred.

    O(T n) worst1 languagesadvanced
  • Escape analysis

    Finds objects that do not outlive their method or thread, so they can be put on the stack and their locks removed.

    O(n^2 h + s h) worst1 languagesadvanced
  • Feautrier scheduling algorithm

    Finds affine schedules with the affine form of Farkas' lemma and linear programming, satisfying as many dependences as possible per dimension.

    O(e L) worst1 languagesadvanced
  • Generational search

    Expands each concolic run by negating every branch condition on its path at once, producing a generation of new inputs to test.

    O(R (T + m C + log R)) worst1 languagesadvanced
  • Gulwani's string transformation synthesis

    The FlashFill method. Build a DAG over output positions with all substring and constant atoms for each example, intersect the DAGs, and pick the best-ranked path.

    O(m^(2k) n^k p) worst case all examples1 languagesadvanced
  • Houdini

    Guesses many candidate invariants and removes those a verifier refutes until the rest are inductive, the largest such subset.

    O(c T + c^2) worst1 languagesadvanced
  • IFDS framework

    Solves interprocedural, finite, distributive, subset problems exactly in O(E D^3) time by graph reachability on an exploded supergraph.

    O(E D^3) worst · average1 languagesadvanced
  • Interprocedural constant propagation

    Finds parameters that are constant on every call by propagating jump functions over the call graph.

    O((v + 1)(n + b v) + (k + 1) n) worst1 languagesadvanced
  • Iterative modulo scheduling

    Software pipelines a loop by trying initiation intervals from a lower bound up, placing operations in a modulo reservation table with backtracking.

    O(n^3 log D + I (n e + B n (n + e + P w))) worst1 languagesadvanced
  • Lamport hyperplane method

    Finds a linear time function such that all iterations on one hyperplane can run in parallel, for loops with uniform dependences.

    O(D k + N k) worst1 languagesadvanced
  • Offline variable substitution

    Finds variables with surely equal points-to sets before solving and merges them, which shrinks the constraint graph.

    O(n^3 + m) worst1 languagesadvanced
  • One-level flow analysis

    Points-to analysis with subset constraints at the top pointer level and unification below. Das measured it nearly as precise as Andersen and nearly as fast as Steensgaard.

    O(n (n + m)) worst1 languagesadvanced
  • Online cycle elimination

    Detects cycles in an inclusion constraint graph while solving and merges their nodes, since all nodes on a cycle have equal sets.

    O(n^4 + n^2 m) worst1 languagesadvanced
  • Operator strength reduction on SSA

    Finds induction variables as strongly connected components of the SSA graph and rewrites their multiplications into additions.

    O(b^3 + (n + m)^2) worst1 languagesadvanced
  • Pettis-Hansen code positioning

    Orders basic blocks and procedures by greedily merging chains along the heaviest edges of the profile, to improve instruction cache use.

    O(E log E + C E) worst1 languagesadvanced
  • SSAPRE

    Performs PRE on SSA form one expression at a time by building a sparse SSA graph of the expression's occurrences.

    O((m + v)(n + d)) worst1 languagesadvanced
  • Sreedhar out-of-SSA translation

    Converts SSA into conventional SSA, where phi-related names do not interfere, by inserting copies, and then drops all phi-functions.

    O(F B N V + N^2 V^2) worst · average1 languagesadvanced
  • Strictness analysis

    Finds functions of a lazy language that surely evaluate an argument, by abstract interpretation over a two-point domain, so it can be passed by value.

    O(4^k n) worst · average1 languagesadvanced
  • Subscript-wise dependence tests

    Classifies subscript pairs by the number of loop indices they use and applies an exact test to each class, joining results by the delta test.

    O(m^2 k + m log C + 3^k m k) worst1 languagesadvanced
  • Superblock scheduling

    Forms traces with one entry by tail duplication and schedules each as a block, with no compensation code at side entries.

    O(m (s N + n^2)) worst1 languagesadvanced
  • Superword-level parallelism vectorization

    Packs isomorphic independent statements of a basic block into SIMD instructions, starting from adjacent memory accesses.

    O(n^3) worst1 languagesadvanced
  • System dependence graph slicing

    Slices across procedures with a system dependence graph and summary edges, in two passes that respect calling context.

    O(N + E) worst1 languagesadvanced
  • Trace scheduling

    Schedules a likely path through several blocks as one block and adds compensation code where other paths enter or leave it.

    O(m (s N + n^2)) worst1 languagesadvanced
  • Type-based alias analysis

    Decides that two references cannot alias when their declared types are incompatible under the rules of a type-safe language.

    O(t^2 h + m log t) worst1 languagesadvanced
  • Variable type analysis

    Prune a sound call graph by pushing the classes of new along the assignments of a type propagation graph and keeping the targets that reach each receiver.

    O((n + P) K) worst1 languagesadvanced
  • Weak topological ordering

    Orders the nodes of a flow graph as nested components with heads, giving the points where to widen and a good order of iteration.

    O((k + 1)(n + m)) worst · average1 languagesadvanced
  • Wolf-Lam locality optimization

    Models temporal and spatial reuse as vector spaces and picks unimodular transformations and tiling that keep the reuse in the innermost loops.

    O(4^k k! k D + 2^k k^3 A^2) worst1 languagesadvanced
  • k-CFA

    Control flow analysis of higher-order programs that keeps a separate binding of each variable for each string of the last k call sites.

    2^O((k+1) n log n) worst1 languagesadvanced
  • Constraint-based invariant generation

    Finds linear inductive invariants by writing an invariant template and solving the conditions it must meet with Farkas' lemma.

    O((|M| + 1)^k L) worst1 languagesresearch
  • Copy-and-patch compilation

    Generates code very fast by copying precompiled binary stencils for each operation and patching holes with operands and addresses.

    O(n) worst1 languagesresearch
  • Demand-driven points-to analysis

    Answers points-to queries for chosen variables only, by searching backward in the constraint graph, often as CFL reachability.

    O(m^3 + m s) worst1 languagesresearch
  • IDE framework

    Extends IFDS to environment problems, such as linear constant propagation, by labeling exploded edges with distributive value functions.

    O(E D^3) worst · average1 languagesresearch
  • Lazy and hybrid cycle detection

    Looks for constraint cycles only when an edge brings no new points-to facts, plus an offline pass, making Andersen's analysis scale.

    O(n^4 + n^2 m) worst1 languagesresearch
  • Linear ranking function synthesis

    Decides whether a simple linear loop has a linear ranking function and finds one, by linear programming.

    O(m n + L) worst1 languagesresearch
  • Linear scan register allocation on SSA form

    Runs linear scan directly on SSA form with lifetime intervals and resolves phi-functions after allocation, without leaving SSA first.

    O(s + b^2 + n^2 b) worst1 languagesresearch
  • Pluto algorithm

    Finds affine transformations that allow tiling and parallelism by minimizing a bound on dependence distances with integer linear programming.

    O((s d + e) I) worst1 languagesresearch
  • Polyhedral scanning

    Generates loop nests that visit the integer points of a union of polyhedra in schedule order, by separating and projecting the polyhedra.

    O(s m P^(n+1) L) worst1 languagesresearch
  • SSA-based register allocation

    Spills until register pressure is at most k everywhere, then colors the chordal SSA interference graph with no further spills.

    O(l + s n^2 + b^2) worst1 languagesresearch
  • Sparse flow-sensitive pointer analysis

    Makes flow-sensitive points-to analysis scale by propagating facts only along def-use chains found by a cheaper pre-analysis.

    O(n^3 m^4) worst1 languagesresearch
  • Stochastic superoptimization

    Searches the space of instruction sequences by Markov chain Monte Carlo with a cost of correctness on tests plus speed.

    O(s L (n + I) + (L + I) L I) worst1 languagesresearch
  • Three-valued logic shape analysis

    Represents heaps by logical structures with a third value for unknown and merges nodes by abstraction predicates, for shape properties.

    O(E M v^2 N^5) worst1 languagesresearch
  • Type-directed program synthesis

    Searches for a program top-down by the goal type, using examples or refinement types to prune each partial program early.

    O(w b^2) one bank1 languagesresearch

Data structures

  • Activation record

    The block of stack memory for one call of a procedure, with its arguments, return address, saved registers and local variables.

    O(h + s) worst1 languagesintro
  • Def-use chains

    Links each definition of a variable to the uses it can reach and each use to the definitions that can reach it.

    1 languagesintro
  • Program dependence graph

    A graph of the statements of a procedure with edges for data and control dependences, used for slicing, vectorization and scheduling.

    O(m + c) control-edges1 languagescore
  • Hidden classes

    Shared descriptors of object layout for dynamic languages, so that objects with the same fields have fixed offsets for fast access.

    O(k) cached-load1 languagesadvanced
  • Loop nesting forest

    A forest whose nodes are the loops of a flow graph, with each loop below the loops that contain it, defined for irreducible graphs too.

    1 languagesadvanced
  • Polymorphic inline cache

    An inline cache that holds several receiver types and their targets at a call site, and records the types seen for later optimization.

    O(k) hit1 languagesadvanced
  • Sea of nodes

    A graph IR in SSA where data and control are both edges and most instructions float free of blocks until scheduling.

    O(n + b v) expected build1 languagesadvanced
  • Version space algebra

    A shared DAG of union and join nodes that stores all programs consistent with some examples, often exponentially many in polynomial space, with intersection and counting.

    O(s^2 d^2) expected build1 languagesadvanced

Techniques

  • Common subexpression elimination

    Computes an expression once and reuses the value where the same expression is computed again with the same operands.

    intro
  • Constant folding

    Evaluates at compile time the operations whose operands are all constants and replaces them by the result, using the arithmetic of the target machine.

    intro
  • Dead code elimination

    Removes instructions whose results are never used and that have no side effects.

    intro
  • Loop unrolling

    Replicates the body of a loop k times and divides the trip count by k, which cuts branch overhead and exposes instruction parallelism.

    intro
  • Loop-invariant code motion

    Moves computations whose operands do not change inside a loop to a preheader before the loop, when this is safe.

    intro
  • Peephole optimization

    Scans a short window of adjacent instructions and replaces patterns by shorter or faster equivalent sequences, until no rule applies.

    intro
  • Bidirectional type checking

    Splits the typing judgment into a checking mode and a synthesis mode, so annotations are needed only where the two modes meet.

    core
  • Critical edge splitting

    Puts a new empty block on each edge from a block with several successors to a block with several predecessors, to host inserted code.

    core
  • Devirtualization

    Replaces a virtual or indirect call by a direct call when analysis shows one target, often guarded by a type test.

    core
  • Function inlining

    Replaces a call by a copy of the body of the callee, which removes call overhead and exposes the body to optimization at the call site.

    core
  • Inline caching

    Caches at each call site the receiver type and method found last time and checks the type on the next call before using it.

    core
  • Loop distribution

    Splits a loop into several loops over the same range, each with part of the body, by the strongly connected components of dependences.

    core
  • Loop fusion

    Merges adjacent loops with the same bounds into one loop, which improves reuse of data and lowers loop overhead.

    core
  • Loop interchange

    Swaps two loops of a nest, which can make memory access contiguous or move a parallel loop outward, when dependences allow.

    core
  • Loop tiling

    Splits the iteration space of a nest into blocks that fit in cache and runs each block fully, for data reuse and parallelism.

    core
  • Monomorphization

    Compiles a polymorphic function by making one specialized copy for each set of type arguments it is used at.

    core
  • Profile-guided optimization

    Runs the program on sample input to measure branch and call frequencies, then uses them to guide inlining, layout and allocation.

    core
  • Software pipelining

    Overlaps iterations of a loop so that a new iteration starts before the previous ends, with a prologue, steady kernel and epilogue.

    core
  • Spill code placement

    Keeps a value in memory and inserts stores after its definitions and loads before its uses when it cannot have a register.

    core
  • Strength reduction

    Replaces costly operations by cheaper ones, such as a multiply by an induction variable in a loop by an add each iteration.

    core
  • Strip mining

    Splits one loop into an outer loop over strips and an inner loop over a fixed number of iterations, as for vector registers.

    core
  • Tail call optimization

    Compiles a call in tail position as a jump that reuses the caller's frame, so tail recursion runs in constant stack space.

    core
  • Threaded code

    Represents an interpreted program as a list of addresses of routines, each ending with a jump to the next, to cut dispatch cost.

    core
  • Vectorization

    Turns loops or statement groups into SIMD instructions that process several data elements at once, when dependences allow.

    core
  • Adaptive optimization

    Starts in an interpreter or quick compiler and recompiles methods with more optimization as profiles show them to be hot.

    advanced
  • Array privatization

    Gives each iteration or thread its own copy of a scratch array written before read in each iteration, removing false dependences.

    advanced
  • Chains of recurrences

    Represents the values of an induction variable over iterations as a chain of add or multiply recurrences, closed under arithmetic.

    advanced
  • Conservative coalescing

    Coalesces two nodes only when a degree test proves that the merged graph stays as colorable as before.

    advanced
  • Constraint-based type inference

    Splits inference into a pass that emits type constraints and a solver for them, so one inference engine serves many constraint domains.

    advanced
  • DOACROSS parallelization

    Runs the iterations of a loop with carried dependences in parallel, and delays each sink with post and wait until its source in an earlier iteration is done.

    advanced
  • Datalog-based program analysis

    Writes an analysis as Datalog rules over facts taken from the program, and runs it on a Datalog engine, often with BDDs or semi-naive evaluation.

    advanced
  • Deductive program synthesis

    Extracts a program from a constructive proof that for every input there is an output meeting the specification.

    advanced
  • Deforestation

    Removes the intermediate trees and lists that one function builds and the next consumes, by fusing the two into one pass.

    advanced
  • Defunctionalization

    Replaces first-class functions by data constructors, one per lambda, and an apply function that dispatches on the constructor.

    advanced
  • Deoptimization

    Falls back from optimized code to the interpreter or less optimized code when a speculative assumption fails, rebuilding the frames.

    advanced
  • Dictionary-passing translation

    Compiles type class constraints into extra arguments that are records of the instance methods, chosen at each call site.

    advanced
  • Elimination methods for dataflow analysis

    Solve dataflow equations by substitution, like Gaussian elimination, with functions as coefficients and a loop closure in place of division.

    advanced
  • Functional approach to interprocedural analysis

    Computes for each procedure a summary function from input facts to output facts and applies it at each call site.

    advanced
  • Grammar-based fuzzing

    Generates test inputs from a grammar of the input format, so that most inputs pass the parser and test deeper code.

    advanced
  • Live range splitting

    Splits the live range of a value into pieces with copies between them, so each piece can get its own register or be spilled.

    advanced
  • Loop skewing

    Adds a multiple of an outer index to an inner one, so that dependences point forward in both loops and tiling or interchange becomes legal.

    advanced
  • Object sensitivity

    Context-sensitive pointer analysis for object-oriented code that tells calls apart by the allocation sites of their receiver objects.

    advanced
  • On-stack replacement

    Moves a running method from one compiled version to another in the middle of its execution, by mapping the live state of its frame.

    advanced
  • Partial evaluation

    Specializes a program to the part of its input known in advance, giving a residual program that takes only the rest of the input.

    advanced
  • Program sketching

    The programmer writes a program with holes and the synthesizer fills the holes with constants or expressions so the assertions hold.

    advanced
  • Proof-carrying code

    Ships machine code with a formal proof that it meets a safety policy, which the host checks with a small fast proof checker.

    advanced
  • Reduced product

    Combines two abstract domains into a product where each component is refined by the facts of the other, as precise as both.

    advanced
  • Register rematerialization

    Recomputes a spilled value that is cheap to compute, such as a constant, instead of reloading it from memory.

    advanced
  • Scalar replacement of aggregates

    Splits a local record or array that does not escape into separate scalar variables, which can then live in registers.

    advanced
  • Superoptimization

    Searches all short instruction sequences for the cheapest one that is equivalent to a given sequence, checked by tests and proof.

    advanced
  • Taint analysis

    Tracks data from untrusted sources through a program and reports when it reaches a sensitive sink without passing a sanitizer.

    advanced
  • Tracing JIT compilation

    Records the operations of a hot loop path as a linear trace, optimizes it with guards for exits, and compiles it to machine code.

    advanced
  • Translation validation

    Proves after each compilation that the output program refines the input one, instead of proving the compiler correct once.

    advanced
  • Type feedback

    Uses the receiver types recorded by inline caches to inline the likely targets of dynamic calls when recompiling hot code.

    advanced
  • Unimodular loop transformations

    Models interchange, reversal and skewing as integer matrices of determinant plus or minus 1 on the iteration space, composed by product.

    advanced
  • BDD-based points-to analysis

    Stores points-to relations and contexts as binary decision diagrams, which makes cloning-based context-sensitive analysis feasible.

    research
  • Bi-abduction

    Infers the missing precondition and the leftover frame of a call in separation logic, which makes heap analysis compositional.

    research
  • Borrow checking

    Checks that each reference to owned memory lives no longer than its owner and that no mutable reference is aliased, without a garbage collector.

    research
  • Equality saturation

    Applies all rewrite rules to an e-graph without choosing, until no rule adds anything, and then extracts the cheapest equivalent program.

    research
  • Equivalence modulo inputs

    Tests compilers by deleting code not run on a given input and checking that the compiled variants all give the same output.

    research
  • Liquid types

    Infers refinement types by abstract interpretation over conjunctions of given qualifiers, with SMT queries to check each subtyping step.

    research
  • Meta-tracing

    Traces the interpreter that runs a user program instead of the program, so a JIT compiler is derived from an annotated interpreter.

    research
  • Self-composition

    Reduces a property of two runs, such as noninterference or equivalence, to a safety property of one program that runs both copies.

    research
  • Self-optimizing AST interpreter

    An AST interpreter whose nodes rewrite themselves to specialized forms from observed types, then are compiled by partial evaluation.

    research
  • Supercompilation

    Drives a program symbolically on unknown input, folds repeated configurations into recursion and generalizes to stop, giving a residual program.

    research

Concepts

  • Dataflow analysis

    Computes facts that hold at each program point on all paths, by propagating them along the control flow graph to a fixed point.

    intro
  • Intermediate representation

    A form of the program between source and machine code on which a compiler analyzes and transforms the program.

    intro
  • Just-in-time compilation

    Compiles code while the program runs, so the compiler can use the actual types, values and profile seen so far.

    intro
  • Type system

    A set of rules that assigns a type to each phrase of a program and rejects the programs whose phrases cannot be typed.

    intro
  • Context sensitivity

    Whether an analysis keeps the facts of different calls to the same procedure apart, by call strings, objects or summaries.

    core
  • Flow sensitivity

    Whether an analysis takes the order of statements into account and computes a fact per program point, or one fact for the whole program.

    core
  • Interprocedural dataflow analysis

    Dataflow analysis across procedure calls, which must match each return with its call to avoid facts from paths that cannot occur.

    core
  • Let-polymorphism

    Polymorphism where only let-bound names get type schemes, and lambda-bound names stay monomorphic, which keeps inference decidable.

    core
  • Path explosion

    The number of paths of a program grows exponentially with its branches and is unbounded with loops, which limits symbolic execution.

    core
  • Subtyping

    A relation S <: T saying a value of type S can be used wherever a T is expected; functions are contravariant in the argument, and records allow width and depth subtyping.

    core
  • Type classes

    Named sets of overloaded operations with instances per type, resolved during inference by constraints on type variables.

    core
  • Dependent types

    Types that depend on values, such as vectors of length n, so that types can state and check full program specifications.

    advanced
  • Effect system

    Extends types with effects, such as the regions a function reads or writes, to reason about side effects and to enable optimizations.

    advanced
  • Field sensitivity

    Whether a pointer analysis keeps the fields of a structure or object apart as separate locations or merges them into one.

    advanced
  • Gradual typing

    Mixes static and dynamic typing in one language with an unknown type, consistency in place of equality, and run-time casts at the borders.

    advanced
  • Linear types

    Types whose values must be used exactly once, or at most once in the affine case, which supports safe in-place update and resources.

    advanced
  • Lost-copy and swap problems

    Two cases where naive phi removal is wrong after copy folding, because phi copies are parallel and live ranges interfere.

    advanced
  • Recursive types

    Types of the form mu a. T that refer to themselves, for lists, trees and objects; equi-recursive types equal their unfolding, while iso-recursive types need explicit fold and unfold.

    advanced
  • Refinement types

    Types that carry a logical predicate on their values, such as the integers greater than zero, checked with a decision procedure.

    advanced
  • Row polymorphism

    Types records and variants with a row variable for the unknown fields, so a function can accept any record that has some fields.

    advanced
  • Verified compilation

    A compiler with a machine-checked proof that the semantics of each compiled program refines the semantics of its source.

    advanced

Definitions

  • Basic block

    A maximal sequence of instructions entered only at the first one and left only at the last, so it runs all or nothing.

    intro
  • Call graph

    A directed graph with one node per procedure and an edge from caller to callee for each possible call.

    intro
  • Control flow graph

    A directed graph whose nodes are the basic blocks of a procedure and whose edges are the possible transfers of control between them.

    intro
  • Path condition

    The conjunction of branch conditions over symbolic inputs that an execution path takes, satisfiable exactly by inputs that follow it.

    intro
  • Three-address code

    A linear IR whose instructions have at most one operator and three operands, such as x = y op z, with jumps for control.

    intro
  • Abstract domain

    A lattice of abstract properties with a concretization map and sound abstract versions of the program operations, join and widening.

    core
  • Collecting semantics

    The semantics that maps each program point to the set of all states that reach it, the most precise property an analysis can compute.

    core
  • Continuation-passing style

    A form where no function returns, and each call passes a continuation that receives the result, so control flow is explicit.

    core
  • Control dependence

    Node n is control dependent on branch b if one edge out of b forces n to run and another can skip it, found from post-dominance frontiers.

    core
  • DOALL loop

    A loop that carries no data dependence at its own level, so its iterations may run in any order or in parallel with the same result.

    core
  • Data dependence

    Two accesses to the same location, at least one a write, whose order must be kept; flow, anti and output by which access writes.

    core
  • Dependence direction vector

    The signs of the components of the distance vectors of a dependence, written with less, equal and greater, when exact distances are unknown.

    core
  • Dependence distance vector

    The difference between the iteration vectors of the sink and the source of a dependence in a loop nest.

    core
  • Distributive dataflow framework

    A monotone framework whose transfer functions distribute over the meet, f(x meet y) = f(x) meet f(y), as gen-kill problems do.

    core
  • Dominance frontier

    The nodes where the dominance of a node n ends, that is, nodes with a predecessor dominated by n that are not strictly dominated by n.

    core
  • Galois connection

    A pair of monotone maps alpha and gamma between concrete and abstract posets with alpha(x) <= y exactly when x <= gamma(y).

    core
  • Gen-kill dataflow problem

    A dataflow problem whose transfer functions have the form f(x) = gen union (x minus kill), solved fast with bit vectors.

    core
  • Hindley-Milner type system

    The type system of ML, with type schemes that quantify type variables at let bindings, so that each typable term has a principal type.

    core
  • Interference graph

    An undirected graph with one vertex per name of a program and an edge between two names that cannot share a register, because one is live where the other is defined.

    core
  • Interval abstract domain

    Abstracts each numeric variable by a lower and an upper bound, a non-relational domain of infinite height that needs widening.

    core
  • Loop-carried dependence

    A dependence between different iterations of a loop, carried by the outermost loop whose distance component is not zero.

    core
  • Maximal fixed-point solution

    The greatest solution of the dataflow equations of a monotone framework, which iterative algorithms compute and which is below the MOP.

    core
  • Meet-over-all-paths solution

    The meet, over all paths from the entry to a point, of the composed transfer functions of the path, which is the ideal dataflow answer.

    core
  • Monotone dataflow framework

    A dataflow problem given by a semilattice of facts of finite height, a direction and monotone transfer functions for the nodes.

    core
  • Natural loop

    For a back edge n to h where h dominates n, the set of nodes that reach n without passing through h, with h as the single header.

    core
  • Phi node

    An SSA instruction at the head of a block that takes one operand per incoming edge and yields the operand of the edge taken.

    core
  • Post-dominance

    Block p post-dominates block v if every path from v to the exit passes through p; the immediate post-dominators form a tree rooted at the exit.

    core
  • Reducible flow graph

    A flow graph whose retreating edges are all back edges to dominators, so every loop has one entry, as in structured programs.

    core
  • Static single assignment form

    An IR where each variable has exactly one definition, with phi-functions at join points that choose a value by the incoming edge.

    core
  • Strongest postcondition

    The most precise condition that holds after a command runs from a state satisfying a given precondition, the forward dual of wp.

    core
  • Symbolic execution tree

    The tree of all paths of symbolic execution of a program, with a node per statement and a path condition per branch.

    core
  • Widening operator

    An upper bound operator whose iteration stabilizes in finitely many steps, used to force fixed-point iteration on infinite height domains to end.

    core
  • A-normal form

    A direct-style IR where each argument is a variable or constant and each intermediate result is named by let, with the benefits of CPS.

    advanced
  • Convex polyhedra abstract domain

    A relational domain of conjunctions of linear inequalities between variables, precise but exponential in the worst case.

    advanced
  • Narrowing operator

    An operator applied after widening that refines a post-fixed point downward while staying sound, in finitely many steps.

    advanced
  • Octagon abstract domain

    A relational domain of constraints plus or minus x plus or minus y <= c, kept in a difference-bound matrix with cubic time closure.

    advanced
  • Pruned SSA form

    Minimal SSA form without the phi-functions whose variable is dead at the join, found with liveness.

    advanced
  • Value restriction

    Generalize the type of a let binding only when its right side is a syntactic value, which keeps polymorphism sound with mutable references.

    advanced
  • Static single information form

    An extension of SSA that also splits variables at branches with sigma-functions, so that facts learned from conditions get their own names.

    research

Theorems

  • Curry-Howard correspondence

    Simple types are the formulas of intuitionistic implicational logic, typed lambda terms are its natural deduction proofs, and beta reduction is the removal of detours from proofs.

    core
  • Full employment theorem for compiler writers

    No algorithm maps every program to a smallest equivalent program, because such an algorithm would decide the halting problem. So every optimizer can be improved.

    core
  • Kleene fixed-point theorem

    A continuous function on a complete partial order with a bottom has a least fixed point, the limit of the iterates from bottom.

    core
  • Legality of loop reordering

    A reordering of loop iterations keeps the meaning if every dependence distance vector remains lexicographically positive after it.

    core
  • MOP-MFP coincidence theorem

    In a distributive framework the maximal fixed-point solution equals the meet-over-all-paths solution; in a monotone one it is below it.

    core
  • NP-completeness of register allocation

    Every graph is the interference graph of some program, so deciding whether a program fits in k registers, each name keeping one register, is NP-complete for every fixed k >= 3.

    core
  • Principal type theorem

    Every typable ML term has a principal type scheme of which all its other types are instances, and algorithm W computes it.

    core
  • Type soundness

    A well-typed closed term never reaches a stuck state. For the simply typed lambda calculus it follows from progress (a value or a step) and preservation (a step keeps the type).

    core
  • Chordality of SSA interference graphs

    The interference graph of a strict SSA program is chordal, so it is colored optimally in polynomial time and its clique size gives the bound.

    advanced
  • Correspondence of SSA and functional programs

    SSA blocks correspond to local functions and phi operands to arguments of jumps, so SSA is a restricted form of CPS or ANF.

    advanced
  • DEXPTIME-completeness of ML typability

    Deciding whether an ML program is typable is complete for deterministic exponential time, since nested lets can double type sizes.

    advanced
  • Futamura projections

    Specializing an interpreter to a program gives a compiled program, specializing the specializer to the interpreter gives a compiler.

    advanced
  • Kam-Ullman iteration bound

    Round-robin dataflow iteration in reverse postorder stops after d + 2 passes for rapid distributive frameworks, where d is the loop-connectedness depth.

    advanced
  • NP-completeness of code generation for DAGs

    Generating optimal code for an expression DAG on a register machine is NP-complete, unlike for trees.

    advanced
  • Undecidability of may-alias analysis

    Precise intraprocedural may-alias analysis is undecidable for languages with recursive data structures and pointers.

    advanced
  • Undecidability of type inference for System F

    Without type annotations, no algorithm decides whether a pure lambda term has a System F type, or whether it has a given type. Wells proved it in 1994 by a reduction from semi-unification.

    advanced
  • EXPTIME-completeness of k-CFA

    For every fixed k at least 1, deciding whether a function flows to a program point under k-CFA is complete for exponential time.

    research
  • NP-hardness of precise flow-insensitive alias analysis

    Deciding precise flow-insensitive may-alias is NP-hard, even with no dynamic memory, when statements may dereference a pointer many times.

    research
  • Pnueli-Rosner theorem

    Synthesis of a reactive system from an LTL specification is complete for doubly exponential time.

    research
  • Transition invariant theorem

    A program terminates iff its transition relation has a transition invariant that is a finite union of well-founded relations.

    research
  • Undecidability of polymorphic recursion

    Type inference for ML with polymorphic recursion is undecidable, as it is equivalent to semi-unification.

    research

Models

  • Simply typed lambda calculus

    The lambda calculus with base types and function types; each well-typed term has a unique type, evaluation never gets stuck, and every reduction sequence terminates.

    core
  • System F

    The simply typed lambda calculus with abstraction over types, so one term works at every type. It is strongly normalizing, and Church-style checking is decidable but Curry-style typing is not.

    core
  • Polyhedral model

    Represents a loop nest with affine bounds and accesses as integer points in polyhedra, with affine schedules and access functions.

    advanced