//===----------------------------------------------------------------------===// 8/16/2004 - Interprocedural Sparse Conditional Constant Propagation These are notes for the eventual implementation of PR415. The -ipsccp pass should be a very powerful CCP implementation, based off of the standard SCCP formulation, but extended to work interprocedurally. It should include the optimization for overdefined values obviously, as most things in the program are not constants. Given that, the algorithm should work something like this: 1. Loop through the program, marking all address taken and external function arguments as overdefined. 2. Add all entry blocks to address taken and external functions to the "newly reachable BB list". 3. Loop over all globals, marking all address taken and external globals as overdefined. 4. Start worklist processing. 5. At the end, rewrite the program, and use -dae to eliminate dead args, mark any globals proven constant as const. In particular, the algorithm should be able to handle CCP load instructions from internal globals that are and are not marked as constant. In particular, the following global should be marked constant: void test() { static int i = 0; if (i) --i; // dead store } This will come up a lot when we start doing optimization of the %llvm.global_ctors list.